/*!
 * 珍妮樂齡
 * Copyright © 2025-2026 宥爵智能科技有限公司 (YouJue Intelligent Technology Co., Ltd.)
 * All rights reserved. Unauthorized copying, modification, or distribution is strictly prohibited.
 * 本程式碼受中華民國著作權法及國際著作權條約保護，未經授權禁止複製、修改或散布。
 * https://www.youjue.ai
 */

/*
============================================
珍妮樂齡 — 前端樣式
============================================
設計理念：
- 乾淨、現代的 SaaS 風格
- 以紫色和藍色為主色調
- 支援響應式設計
============================================
*/

/* === CSS 變數（全域設定） === */
:root {
    /* 主色調（樂齡暖色：珊瑚，對齊 landing.css） */
    --primary-color: #F2784B;       /* Coral */
    --primary-light: #F89A77;
    --primary-dark: #E0633A;

    /* 輔助色 */
    --secondary-color: #E8857B;     /* Rose */
    --accent-color: #3FA796;        /* Teal */

    /* 樂齡暖色補充 */
    --coral: #F2784B;
    --coral-dark: #E0633A;
    --coral-soft: #FFE6DA;
    --teal: #3FA796;
    --rose: #E8857B;
    --amber: #E8A23D;
    --bg-warm: #FFF1E8;

    /* 背景色 */
    --bg-color: #FFF9F3;
    --bg-dark: #3D2F2A;
    --card-bg: #FFFFFF;

    /* 文字色 */
    --text-primary: #3A352F;
    --text-secondary: #6E665C;
    --text-light: #9A9186;

    /* 邊框和陰影 */
    --border-color: #F0E2D6;
    --border-radius: 14px;
    --border-radius-lg: 22px;

    --shadow-sm: 0 1px 2px rgba(180, 120, 80, 0.08);
    --shadow-md: 0 4px 10px rgba(180, 120, 80, 0.12);
    --shadow-lg: 0 10px 24px rgba(180, 120, 80, 0.16);
    --shadow-xl: 0 20px 40px rgba(180, 120, 80, 0.18);

    /* 動畫 */
    --transition: all 0.25s ease;
}

/* === Reset === */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html, body {
    overflow-x: hidden;
    width: 100%;
}

body {
    font-family: 'Noto Sans TC', 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-primary);
    font-size: 17px;          /* 樂齡：放大基礎字級 */
    line-height: 1.8;         /* 樂齡：寬行距好讀 */
    -webkit-font-smoothing: antialiased;
}

/* === 通用元素 === */
a {
    color: var(--primary-color);
    text-decoration: none;
    transition: var(--transition);
}

a:hover {
    color: var(--primary-dark);
}

button {
    font-family: inherit;
    cursor: pointer;
    transition: var(--transition);
}

input, select, textarea {
    font-family: inherit;
    font-size: 1rem;
}

/* === 按鈕樣式 === */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    border-radius: 8px;
    font-weight: 500;
    font-size: 0.95rem;
    border: none;
    transition: var(--transition);
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(242, 120, 75, 0.4);
}

.btn-secondary {
    background: white;
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background: var(--bg-color);
    border-color: var(--primary-color);
}

.btn-accent {
    background: linear-gradient(135deg, #F59E0B, #D97706);
    color: white;
}

.btn-accent:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.4);
}

.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
}

.btn-ghost:hover {
    color: var(--primary-color);
    background: rgba(242, 120, 75, 0.1);
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
}

/* === 輸入框 === */
.input-group {
    margin-bottom: 20px;
}

.input-group label {
    display: block;
    margin-bottom: 8px;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-primary);
}

.input-group input,
.input-group select {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: white;
    color: var(--text-primary);
    transition: var(--transition);
}

.input-group input:focus,
.input-group select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(242, 120, 75, 0.1);
}

.input-group input::placeholder {
    color: var(--text-light);
}

/* === 卡片 === */
.card {
    background: var(--card-bg);
    border-radius: var(--border-radius);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
}

/* === 登入/註冊頁面 === */
.auth-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #1E1B4B 0%, #312E81 50%, #4C1D95 100%);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    transition: opacity 0.5s ease, visibility 0.5s;
}

.auth-overlay.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.auth-container {
    width: 100%;
    max-width: 440px;
    padding: 20px;
}

.auth-card {
    background: white;
    border-radius: var(--border-radius-lg);
    padding: 40px;
    box-shadow: var(--shadow-xl);
}

.auth-logo {
    text-align: center;
    margin-bottom: 30px;
}

.auth-logo img {
    height: 80px;
    margin-bottom: 15px;
}

.auth-logo-emoji {
    font-size: 80px;
    line-height: 1;
    margin-bottom: 15px;
}

.auth-logo h1 {
    font-size: 1.5rem;
    color: var(--text-primary);
    font-weight: 700;
}

.auth-logo p {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-top: 5px;
}

.auth-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 25px;
    background: var(--bg-color);
    padding: 4px;
    border-radius: 8px;
}

.auth-tab {
    flex: 1;
    padding: 10px;
    text-align: center;
    background: transparent;
    border: none;
    border-radius: 6px;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition);
}

.auth-tab.active {
    background: white;
    color: var(--primary-color);
    box-shadow: var(--shadow-sm);
}

.auth-form {
    display: none;
}

.auth-form.active {
    display: block;
}

.auth-error {
    background: #FEF2F2;
    color: #DC2626;
    padding: 12px;
    border-radius: 8px;
    margin-bottom: 20px;
    font-size: 0.9rem;
    display: none;
}

.auth-error.show {
    display: block;
}

/* 分隔線 */
.auth-divider {
    display: flex;
    align-items: center;
    margin: 20px 0;
    color: var(--text-light);
    font-size: 0.85rem;
}

.auth-divider::before,
.auth-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border-color);
}

.auth-divider span {
    padding: 0 12px;
}

/* Google 登入按鈕容器 */
.google-btn-wrapper {
    display: flex;
    justify-content: center;
    padding-bottom: 4px;
    max-width: 100%;
    overflow: hidden;
}

/* 手機版認證頁面適配 */
@media (max-width: 768px) {
    .auth-overlay {
        align-items: flex-start;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }

    .auth-container {
        padding: 16px 16px calc(16px + env(safe-area-inset-bottom, 20px));
        margin-top: auto;
        margin-bottom: auto;
    }

    .auth-card {
        padding: 28px 24px;
    }

    .auth-logo {
        margin-bottom: 20px;
    }

    .auth-logo img {
        height: 60px;
        margin-bottom: 10px;
    }

    .auth-logo h1 {
        font-size: 1.3rem;
    }

    .auth-logo p {
        font-size: 0.82rem;
    }

    .auth-tabs {
        margin-bottom: 18px;
    }

    .auth-tab {
        padding: 8px;
        font-size: 0.9rem;
    }

    .input-group {
        margin-bottom: 12px;
    }

    .input-group label {
        font-size: 0.82rem;
        margin-bottom: 4px;
    }

    .input-group input {
        padding: 10px 12px;
        font-size: 0.9rem;
    }

    .auth-divider {
        margin: 14px 0;
    }
}

/* === 主應用程式容器 === */
.app-container {
    display: flex;
    min-height: 100vh;
}

/* === 側邊欄 === */
.sidebar {
    width: 280px;
    background: white;
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    height: 100dvh; /* iOS Safari 動態視窗高度 */
    left: 0;
    top: 0;
    z-index: 100;
    transition: transform 0.3s ease;
}

.sidebar-header {
    padding: 20px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 12px;
}

.sidebar-header img {
    height: 40px;
}

.sidebar-header h2 {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-primary);
}

.sidebar-nav {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-radius: 8px;
    color: var(--text-secondary);
    font-weight: 500;
    margin-bottom: 4px;
    transition: var(--transition);
}

.nav-item:hover {
    background: var(--bg-color);
    color: var(--text-primary);
}

.nav-item.active {
    background: rgba(242, 120, 75, 0.1);
    color: var(--primary-color);
}

/* 記帳簿 & 記事本 — 常態使用項目特殊底色標記 */
.nav-item[data-page="bookkeeping"],
.nav-item[data-page="calendar"] {
    background: linear-gradient(135deg, rgba(255, 241, 232, 0.8), rgba(255, 244, 238, 0.8));
    border: 1px solid rgba(247, 211, 191, 0.5);
}
.nav-item[data-page="bookkeeping"]:hover,
.nav-item[data-page="calendar"]:hover {
    background: linear-gradient(135deg, rgba(255, 230, 218, 0.95), rgba(255, 233, 223, 0.95));
    border-color: rgba(243, 184, 154, 0.6);
}
.nav-item[data-page="bookkeeping"].active,
.nav-item[data-page="calendar"].active {
    background: linear-gradient(135deg, rgba(242, 120, 75, 0.15), rgba(248, 154, 119, 0.12));
    border-color: rgba(248, 154, 119, 0.5);
}

.nav-item i {
    width: 20px;
    text-align: center;
}

/* 問題申訴與鼓勵 — 粉紅色強調 */
.nav-item[data-page="feedback"] {
    color: #e8857b;
}
.nav-item[data-page="feedback"]:hover {
    color: #d86b61;
}
.nav-item[data-page="feedback"].active {
    background: rgba(232, 133, 123, 0.1);
    color: #d86b61;
}

/* --- 技巧教學頁籤粉紅提示燈箱 --- */
/* 桌面版：一行顯示，位於「技巧教學」文字上方，箭頭朝下 */
.nav-tip-bubble {
    position: absolute;
    left: 16px;
    bottom: calc(100% - 2px);
    background: linear-gradient(135deg, #e8857b, #f0a59c);
    color: #fff;
    font-size: 0.6rem;
    font-weight: 600;
    padding: 3px 8px;
    border-radius: 6px;
    white-space: nowrap;
    box-shadow: 0 2px 8px rgba(232, 133, 123, 0.35);
    pointer-events: none;
    animation: navTipPulse 2.5s ease-in-out infinite;
    z-index: 10;
    line-height: 1.3;
}

.nav-tip-bubble::before {
    content: '';
    position: absolute;
    top: 100%;
    left: 20px;
    border: 4px solid transparent;
    border-top-color: #e8857b;
}

.nav-item {
    position: relative;
}

@keyframes navTipPulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.85; transform: scale(1.03); }
}

/* 手機版燈箱：兩行顯示，放在「技巧教學」文字右邊空白處，箭頭指向文字 */
@media (max-width: 768px) {
    .nav-tip-bubble {
        left: 145px;
        top: 50%;
        bottom: auto;
        transform: translateY(-50%);
        font-size: 0.6rem;
        padding: 5px 10px;
        white-space: normal;
        max-width: 140px;
        line-height: 1.4;
        text-align: left;
        animation: navTipPulseMobile 2.5s ease-in-out infinite;
    }
    .nav-tip-bubble::before {
        right: 100%;
        left: auto;
        top: 50%;
        bottom: auto;
        transform: translateY(-50%);
        border: 5px solid transparent;
        border-right-color: #e8857b;
    }
    @keyframes navTipPulseMobile {
        0%, 100% { opacity: 1; transform: translateY(-50%) scale(1); }
        50% { opacity: 0.85; transform: translateY(-50%) scale(1.03); }
    }
}

/* --- 側邊欄拖曳排序視覺回饋 --- */
.nav-reorder-active {
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
}

/* 防止 Safari 長按觸發連結預覽選單 */
.sidebar-nav .nav-item {
    -webkit-touch-callout: none;
}

.nav-dragging {
    opacity: 0.25;
    pointer-events: none;
}

.nav-drag-ghost {
    position: fixed;
    z-index: 10000;
    pointer-events: none;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-radius: 8px;
    background: rgba(242, 120, 75, 0.12);
    color: var(--primary-color);
    font-weight: 500;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
    opacity: 0.92;
    transform: scale(1.04);
    transition: none;
}

.nav-drag-placeholder {
    border: 2px dashed var(--primary-color);
    border-radius: 8px;
    margin-bottom: 4px;
    background: rgba(242, 120, 75, 0.05);
    box-sizing: border-box;
}

.sidebar-footer {
    padding: 20px;
    padding-bottom: calc(20px + env(safe-area-inset-bottom, 0px));
    border-top: 1px solid var(--border-color);
    flex-shrink: 0;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: var(--bg-color);
    border-radius: 8px;
    margin-bottom: 10px;
}

.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
}

.user-details {
    flex: 1;
    min-width: 0;
}

.user-name {
    font-weight: 600;
    font-size: 0.9rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-email {
    font-size: 0.75rem;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* === 主內容區 === */
.main-content {
    flex: 1;
    margin-left: 280px;
    padding: 30px;
    min-height: 100vh;
}

.page-header {
    margin-bottom: 30px;
}

.page-header h1 {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.page-header p {
    color: var(--text-secondary);
}

/* === 檔案上傳區 === */
.upload-zone {
    border: 2px dashed var(--border-color);
    border-radius: var(--border-radius);
    padding: 40px;
    text-align: center;
    background: white;
    transition: var(--transition);
    cursor: pointer;
}

.upload-zone:hover,
.upload-zone.dragover {
    border-color: var(--primary-color);
    background: rgba(242, 120, 75, 0.05);
}

.upload-zone i {
    font-size: 3rem;
    color: var(--primary-color);
    margin-bottom: 15px;
}

.upload-zone h3 {
    font-size: 1.1rem;
    margin-bottom: 8px;
}

.upload-zone p {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

/* === Google Sheets 匯入 === */
.gsheet-import-section {
    margin-top: 16px;
    padding: 20px 25px;
    background: white;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
}

.gsheet-import-header {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 12px;
}

.gsheet-import-header i {
    color: #34A853;
    font-size: 1.1rem;
}

.gsheet-import-form {
    display: flex;
    gap: 10px;
}

.gsheet-input {
    flex: 1;
    padding: 10px 14px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 0.9rem;
    outline: none;
    transition: var(--transition);
}

.gsheet-input:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(242, 120, 75, 0.1);
}

.gsheet-btn {
    white-space: nowrap;
    padding: 10px 20px;
    font-size: 0.9rem;
}

.gsheet-hint {
    font-size: 0.8rem;
    color: var(--text-light);
    margin-top: 8px;
}

/* === Google Sheet 匯入進度條 === */
.gsheet-progress {
    margin-top: 14px;
    animation: fadeIn 0.3s ease;
}

.gsheet-progress-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
    font-size: 0.82rem;
    color: var(--text-secondary);
}

.gsheet-progress-info span:first-child {
    font-weight: 500;
}

.gsheet-progress-bar {
    width: 100%;
    height: 8px;
    background: var(--bg-secondary);
    border-radius: 4px;
    overflow: hidden;
}

.gsheet-progress-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--primary-color), #f89a77);
    border-radius: 4px;
    transition: width 0.4s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-5px); }
    to { opacity: 1; transform: translateY(0); }
}

/* === 檔案列表 === */
.file-list {
    margin-top: 20px;
}

.file-item {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 15px;
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    margin-bottom: 10px;
}

.file-icon {
    width: 45px;
    height: 45px;
    border-radius: 8px;
    background: var(--bg-color);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary-color);
    font-size: 1.2rem;
}

.file-info {
    flex: 1;
}

.file-name {
    font-weight: 500;
    margin-bottom: 4px;
}

.file-meta {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.file-actions {
    display: flex;
    gap: 6px;
    align-items: center;
}

.file-actions button {
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 0.85rem;
}

/* 檔案下載按鈕 */
.btn-download {
    color: var(--primary-color) !important;
}

.btn-download:hover {
    background: rgba(242, 120, 75, 0.1) !important;
    color: var(--primary-dark) !important;
}

/* Google Sheet 同步按鈕 */
.btn-resync {
    color: #38A169 !important;
    transition: transform 0.3s ease;
}

.btn-resync:hover {
    background: #f0fff4 !important;
}

.btn-resync:hover i {
    transform: rotate(180deg);
}

.btn-resync i {
    transition: transform 0.4s ease;
}

/* 未解鎖的同步按鈕（上鎖狀態） */
.btn-resync-locked {
    color: #A0AEC0 !important;
    cursor: pointer;
    position: relative;
}

.btn-resync-locked:hover {
    background: #FFF5F5 !important;
    color: #E53E3E !important;
}

/* Google Sheet 來源標記 */
.gsheet-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 0.7rem;
    color: #38A169;
    background: #f0fff4;
    padding: 1px 6px;
    border-radius: 4px;
    margin-left: 6px;
    font-weight: 500;
}

/* Google Doc 來源標記（藍色） */
.gdoc-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 0.7rem;
    color: #4285F4;
    background: #EBF3FF;
    padding: 1px 6px;
    border-radius: 4px;
    margin-left: 6px;
    font-weight: 500;
}

/* Google Doc 匯入區塊 icon 改藍色 */
.gdoc-import-section .gsheet-import-header i {
    color: #4285F4;
}

/* 同步按鈕的 spinner */
.btn-resync .spinner,
.btn-resync-locked .spinner {
    width: 14px;
    height: 14px;
    border: 2px solid #e2e8f0;
    border-top-color: #38A169;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    display: inline-block;
}

/* === 設定頁面 === */
.settings-section {
    background: white;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 25px;
    margin-bottom: 20px;
}

.settings-section h3 {
    font-size: 1.1rem;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid var(--border-color);
}

/* === 性別選擇 === */
.settings-desc {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 15px;
}

.gender-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
}

.gender-card {
    padding: 20px;
    border: 2px solid var(--border-color);
    border-radius: 12px;
    cursor: pointer;
    transition: var(--transition);
    text-align: center;
}

.gender-card:hover {
    border-color: var(--primary-light);
}

.gender-card.selected {
    border-color: var(--primary-color);
    background: rgba(242, 120, 75, 0.05);
}

.gender-card .emoji {
    font-size: 2.5rem;
    margin-bottom: 10px;
}

.gender-card h4 {
    font-size: 1rem;
    margin-bottom: 5px;
}

.gender-card p {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

/* === 人設選擇 === */
.persona-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 15px;
}

.persona-card {
    padding: 20px;
    border: 2px solid var(--border-color);
    border-radius: 12px;
    cursor: pointer;
    transition: var(--transition);
    text-align: center;
}

.persona-card:hover {
    border-color: var(--primary-light);
}

.persona-card.selected {
    border-color: var(--primary-color);
    background: rgba(242, 120, 75, 0.05);
}

.persona-card .emoji {
    font-size: 2.5rem;
    margin-bottom: 10px;
}

.persona-card h4 {
    font-size: 1rem;
    margin-bottom: 5px;
}

.persona-card p {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

/* === 頭像選擇 === */
.avatar-section-header {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.avatar-section-header h3 {
    margin: 0;
}

.avatar-refresh-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 5px 14px;
    font-size: 13px;
    color: #f2784b;
    background: #fff1e8;
    border: 1px solid #f7d3bf;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.avatar-refresh-btn:hover {
    background: #ffe6da;
    border-color: #f3b89a;
}

.avatar-refresh-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.avatar-refresh-hint {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12.5px;
    color: #e8857b;
    margin-top: 4px;
    margin-bottom: 4px;
}

.avatar-refresh-hint i {
    flex-shrink: 0;
}

.avatar-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 12px;
}

.avatar-card {
    padding: 4px;
    border: 3px solid var(--border-color);
    border-radius: 12px;
    cursor: pointer;
    transition: var(--transition);
    aspect-ratio: 1;
    overflow: hidden;
}

.avatar-card img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 8px;
}

.avatar-card:hover {
    border-color: var(--primary-light);
    transform: scale(1.05);
}

.avatar-card.selected {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(242, 120, 75, 0.3);
}

/* 自訂上傳頭像卡片 */
.avatar-upload-card {
    display: flex;
    align-items: center;
    justify-content: center;
    border-style: dashed;
}

.avatar-upload-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    color: var(--text-secondary);
    font-size: 0.75rem;
    text-align: center;
    line-height: 1.3;
}

.avatar-upload-placeholder i {
    font-size: 1.5rem;
    color: var(--primary-color);
}

.avatar-upload-card:hover {
    border-color: var(--primary-color);
    background: rgba(242, 120, 75, 0.05);
}

.avatar-upload-card:hover .avatar-upload-placeholder i {
    transform: scale(1.2);
}

.avatar-upload-preview {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 8px;
}

.avatar-grid {
    grid-template-columns: repeat(6, 1fr);
}

/* === 職業賦能選擇 === */
.career-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 15px;
}

.career-card {
    padding: 20px;
    border: 2px solid var(--border-color);
    border-radius: 12px;
    cursor: pointer;
    transition: var(--transition);
    text-align: center;
}

.career-card:hover {
    border-color: var(--primary-light);
}

.career-card.selected {
    border-color: var(--primary-color);
    background: rgba(242, 120, 75, 0.05);
}

.career-card .emoji {
    font-size: 2.5rem;
    margin-bottom: 10px;
}

.career-card h4 {
    font-size: 1rem;
    margin-bottom: 5px;
}

.career-card p {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

/* === 鎖定覆蓋層（方案限制）=== */
.persona-card,
.avatar-card,
.career-card {
    position: relative;
}

.lock-overlay {
    display: none;
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    border-radius: 10px;
    z-index: 10;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.2rem;
    cursor: pointer;
}

.lock-overlay-round {
    border-radius: 8px;
}

.persona-card.locked .lock-overlay,
.avatar-card.locked .lock-overlay,
.career-card.locked .lock-overlay {
    display: flex;
}

.persona-card.locked,
.avatar-card.locked,
.career-card.locked {
    opacity: 0.7;
    cursor: pointer;
}

.persona-card.locked:hover .lock-overlay,
.avatar-card.locked:hover .lock-overlay,
.career-card.locked:hover .lock-overlay {
    background: rgba(242, 120, 75, 0.7);
}

/* === 方案徽章 === */
.user-tier-badge {
    display: inline-block;
    font-size: 0.65rem;
    padding: 2px 8px;
    border-radius: 10px;
    font-weight: 600;
    margin-top: 4px;
    background: var(--bg-color);
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
}

.user-tier-badge.tier-standard {
    background: linear-gradient(135deg, #f2784b, #f89a77);
    color: white;
    border-color: transparent;
}

.user-tier-badge.tier-pro {
    background: linear-gradient(135deg, #F59E0B, #EAB308);
    color: white;
    border-color: transparent;
}

/* === 每日剩餘提問次數 === */
.daily-remaining {
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.75rem;
    margin-top: 4px;
}

.daily-remaining span {
    font-weight: 600;
    color: white;
}

.bonus-remaining-chat {
    color: rgba(255, 255, 255, 0.8);
    font-size: 0.7rem;
    margin-top: 2px;
}

/* === 訂閱方案頁面 === */

@media (max-width: 480px) {
    .avatar-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 8px;
    }
    .gender-grid {
        grid-template-columns: 1fr 1fr;
        gap: 8px;
    }
}

/* 幣別符號 */
.price-currency {
    font-size: 0.85em;
    font-weight: 500;
    vertical-align: super;
    margin-right: 1px;
}

.billing-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-bottom: 12px;
}

/* 付款方式切換（Stripe / ECPay） */
.gateway-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0;
    margin-bottom: 24px;
    background: var(--bg-secondary);
    border-radius: 12px;
    padding: 4px;
    border: 1px solid var(--border-color);
    max-width: 400px;
    margin-left: auto;
    margin-right: auto;
}

.gateway-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 16px;
    border: none;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.25s ease;
    background: transparent;
    color: var(--text-secondary);
    white-space: nowrap;
}

.gateway-btn:hover {
    color: var(--text-primary);
    background: rgba(242, 120, 75, 0.06);
}

.gateway-btn.active {
    background: white;
    color: var(--primary-color);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.1);
}

.gateway-btn.active[data-gateway="ecpay"] {
    color: #2e8576;
}

.gateway-currency {
    display: inline-block;
    padding: 1px 6px;
    border-radius: 4px;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.5px;
    background: rgba(242, 120, 75, 0.1);
    color: var(--primary-color);
}

.gateway-btn.active .gateway-currency {
    background: var(--primary-color);
    color: white;
}

.gateway-btn.active[data-gateway="ecpay"] .gateway-currency {
    background: #2e8576;
    color: white;
}

/* 待切換計費週期提示 */
.pending-billing-banner {
    max-width: 600px;
    margin: 0 auto 24px;
    padding: 14px 20px;
    background: linear-gradient(135deg, #FEF3C7, #FDE68A);
    border: 1px solid #F59E0B;
    border-radius: 12px;
    animation: pendingBannerSlideIn 0.3s ease;
}

/* ============================================
   金流系統維護中橫幅
   （YJ-金流開關標準功能-01）
   ============================================ */

.pricing-maintenance-banner {
    max-width: 720px;
    margin: 0 auto 24px;
    padding: 16px 22px;
    background: linear-gradient(135deg, #FEF3C7, #FDE68A);
    border: 2px solid #D97706;
    border-radius: 14px;
    display: flex;
    align-items: center;
    gap: 14px;
    box-shadow: 0 4px 14px rgba(217, 119, 6, 0.18);
    animation: pendingBannerSlideIn 0.3s ease;
}

.pricing-maintenance-banner > i {
    font-size: 1.6rem;
    color: #B45309;
    flex-shrink: 0;
}

.pricing-maintenance-text {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.pricing-maintenance-text strong {
    font-size: 1rem;
    color: #78350F;
    font-weight: 700;
}

.pricing-maintenance-text span {
    font-size: 0.88rem;
    color: #92400E;
    line-height: 1.5;
}

/* 升降級按鈕在維護中時的灰調樣式 */
.pricing-btn.maintenance-locked {
    background: #F3F4F6 !important;
    color: #9CA3AF !important;
    border: 1px dashed #D1D5DB !important;
    cursor: not-allowed !important;
    box-shadow: none !important;
}

.pricing-btn.maintenance-locked:hover {
    background: #F3F4F6 !important;
    transform: none !important;
}

@keyframes pendingBannerSlideIn {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

.pending-billing-content {
    display: flex;
    align-items: center;
    gap: 12px;
}

.pending-billing-content > i {
    font-size: 1.3rem;
    color: #D97706;
    flex-shrink: 0;
}

.pending-billing-text {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.pending-billing-text strong {
    font-size: 0.9rem;
    color: #92400E;
}

.pending-billing-text span {
    font-size: 0.8rem;
    color: #A16207;
}

/* 待降級方案提示 */
.pending-downgrade-banner {
    max-width: 600px;
    margin: 0 auto 24px;
    padding: 14px 20px;
    background: linear-gradient(135deg, #FEE2E2, #FECACA);
    border: 1px solid #EF4444;
    border-radius: 12px;
    animation: pendingBannerSlideIn 0.3s ease;
}

.pending-downgrade-banner .pending-billing-content > i {
    color: #DC2626;
}

.pending-downgrade-banner .pending-billing-text strong {
    color: #991B1B;
}

.pending-downgrade-banner .pending-billing-text span {
    color: #B91C1C;
}

.btn-outline-danger {
    background: transparent;
    color: #DC2626;
    border: 1px solid #DC2626;
    padding: 4px 12px;
    border-radius: 6px;
    font-size: 0.78rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
    flex-shrink: 0;
}

.btn-outline-danger:hover {
    background: #DC2626;
    color: white;
}

.btn-sm {
    padding: 4px 12px;
    font-size: 0.78rem;
}

.billing-label {
    font-size: 0.95rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.save-badge {
    display: inline-block;
    background: #DCFCE7;
    color: #16A34A;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 0.75rem;
    font-weight: 600;
}

/* 開關按鈕 */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 26px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--border-color);
    border-radius: 26px;
    transition: var(--transition);
}

.toggle-slider:before {
    content: "";
    position: absolute;
    height: 20px;
    width: 20px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    border-radius: 50%;
    transition: var(--transition);
    box-shadow: var(--shadow-sm);
}

.toggle-switch input:checked + .toggle-slider {
    background-color: var(--primary-color);
}

.toggle-switch input:checked + .toggle-slider:before {
    transform: translateX(24px);
}

/* ============================================
   跨對話記憶 — 資料管理卡片
   ============================================ */

.memory-danger-zone {
    border: 1px solid rgba(239, 68, 68, 0.15);
    background: rgba(239, 68, 68, 0.02);
    border-radius: var(--border-radius-lg);
}

.memory-action-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 16px;
    border: 1px solid var(--border-color);
    border-left: 4px solid #f59e0b;
    border-radius: var(--border-radius);
    margin-bottom: 12px;
    background: var(--bg-secondary);
    transition: border-color 0.2s, box-shadow 0.2s;
}

.memory-action-card:hover {
    border-color: #f59e0b;
    box-shadow: 0 2px 8px rgba(245, 158, 11, 0.1);
}

.memory-action-nuclear {
    border-left-color: #ef4444;
}

.memory-action-nuclear:hover {
    border-color: #ef4444;
    box-shadow: 0 2px 8px rgba(239, 68, 68, 0.1);
}

.memory-action-info {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    flex: 1;
    min-width: 0;
}

.memory-action-icon {
    font-size: 1.8rem;
    flex-shrink: 0;
    line-height: 1;
}

.memory-action-title {
    font-weight: 600;
    font-size: 0.95rem;
    margin-bottom: 4px;
    color: var(--text-primary);
}

.memory-action-desc {
    font-size: 0.8rem;
    color: var(--text-secondary);
    line-height: 1.4;
}

.memory-btn-danger {
    background: #f59e0b;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: var(--border-radius);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.2s, transform 0.1s;
    flex-shrink: 0;
}

.memory-btn-danger:hover {
    background: #d97706;
    transform: translateY(-1px);
}

.memory-btn-nuclear {
    background: #ef4444;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: var(--border-radius);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.2s, transform 0.1s;
    flex-shrink: 0;
}

.memory-btn-nuclear:hover {
    background: #dc2626;
    transform: translateY(-1px);
}

/* 手機版：資料管理卡片堆疊 */
@media (max-width: 640px) {
    .memory-action-card {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
    }

    .memory-btn-danger,
    .memory-btn-nuclear {
        width: 100%;
        text-align: center;
        padding: 10px 16px;
    }
}

/* 方案卡片網格 */
.pricing-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 16px;
    max-width: 1400px;
}

.pricing-card {
    background: white;
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    padding: 24px;
    display: flex;
    flex-direction: column;
    position: relative;
    transition: var(--transition);
}

.pricing-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.pricing-card.featured {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 1px var(--primary-color), var(--shadow-md);
}

.pricing-card.current-plan {
    border-color: var(--accent-color);
}

.pricing-popular {
    position: absolute;
    top: -12px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--primary-color);
    color: white;
    padding: 4px 16px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    white-space: nowrap;
}

/* 企業版樣式 */
.pricing-card-enterprise {
    border-color: #f59e0b;
    box-shadow: 0 0 0 1px #f59e0b, var(--shadow-md);
}

.pricing-popular-enterprise {
    background: linear-gradient(135deg, #f59e0b, #d97706) !important;
}

.enterprise-selector {
    margin-bottom: 20px;
    text-align: center;
}

.enterprise-selector label {
    display: block;
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 8px;
    font-weight: 500;
}

.enterprise-select {
    width: 100%;
    padding: 10px 12px;
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius);
    font-size: 0.9rem;
    color: var(--text-primary);
    background: white;
    cursor: pointer;
    transition: var(--transition);
}

.enterprise-select:focus {
    outline: none;
    border-color: #f59e0b;
    box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.2);
}

.pricing-btn-enterprise {
    background: linear-gradient(135deg, #f59e0b, #d97706) !important;
    border: none !important;
}

.pricing-btn-enterprise:hover {
    background: linear-gradient(135deg, #d97706, #b45309) !important;
}

.pricing-header {
    text-align: center;
    margin-bottom: 25px;
    padding-bottom: 25px;
    border-bottom: 1px solid var(--border-color);
}

.pricing-header h3 {
    font-size: 1.2rem;
    font-weight: 700;
    margin-bottom: 15px;
    color: var(--text-primary);
}

.pricing-price {
    display: flex;
    align-items: baseline;
    justify-content: center;
    gap: 4px;
}

.price-amount {
    font-size: 2.5rem;
    font-weight: 800;
    color: var(--text-primary);
}

.price-period {
    font-size: 1rem;
    color: var(--text-secondary);
}

.pricing-desc {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-top: 8px;
}

.pricing-save {
    color: #16A34A;
    font-weight: 600;
    min-height: 1.2em;
}

.pricing-features {
    list-style: none;
    flex: 1;
    margin-bottom: 25px;
}

.pricing-features li {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 0;
    font-size: 0.9rem;
    color: var(--text-primary);
}

.pricing-features li i.fa-check {
    color: var(--accent-color);
    font-size: 0.85rem;
}

.pricing-features li i.fa-xmark {
    color: var(--text-light);
    font-size: 0.85rem;
}

.pricing-features li.disabled {
    color: var(--text-light);
}

.pricing-btn {
    width: 100%;
    padding: 14px;
    font-size: 1rem;
    font-weight: 600;
}

.pricing-btn:disabled {
    background: var(--bg-color);
    color: var(--text-secondary);
    cursor: default;
    transform: none !important;
    box-shadow: none !important;
}

@media (max-width: 1400px) {
    .pricing-grid {
        grid-template-columns: repeat(3, 1fr);
        max-width: 900px;
    }
}

@media (max-width: 1100px) {
    .pricing-grid {
        grid-template-columns: repeat(2, 1fr);
        max-width: 700px;
    }
}

@media (max-width: 700px) {
    .pricing-grid {
        grid-template-columns: 1fr;
        max-width: 400px;
        margin: 0 auto;
    }
}

/* === 聊天介面 === */
.chat-container {
    position: fixed;
    right: 30px;
    z-index: 500;
    /* bottom 由 JS 動態設定（支援拖曳到上/中/下錨點） */
}

.chat-fab {
    width: 65px;
    height: 65px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    border: none;
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: grab;
    transition: var(--transition);
    user-select: none;
    -webkit-user-select: none;
    touch-action: none;
}

.chat-fab:hover {
    transform: scale(1.1);
    box-shadow: var(--shadow-xl);
}

.chat-fab.dragging {
    cursor: grabbing;
    transform: scale(1.12);
    box-shadow: var(--shadow-xl);
    transition: transform 0.1s, box-shadow 0.1s;
}

/* 彈性吸附動畫 */
.chat-container.snapping {
    transition: top 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.chat-fab img {
    width: 70%;
    height: 70%;
    object-fit: contain;
    transition: opacity 0.3s ease;
}

/* FAB 內部影片（預設隱藏） */
.chat-fab video {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
    display: none;
    pointer-events: none;
}

/* FAB 影片播放時放大 5 倍 + 粉紅光暈 */
.chat-fab.fab-video-playing {
    transform: scale(5) !important;
    /* transform-origin 由 JS 動態設定 */
    box-shadow: 0 0 60px rgba(255,183,221,0.55), 0 0 120px rgba(255,183,221,0.25);
    border: 3px solid rgba(255,183,221,0.85);
    z-index: 10000;
    transition: transform 0.5s cubic-bezier(0.34, 1.56, 0.64, 1),
                box-shadow 0.5s ease,
                border-color 0.5s ease;
}

.chat-fab:not(.fab-video-playing):not(.dragging) {
    transition: transform 0.4s ease, box-shadow 0.3s ease;
}

/* FAB 呼吸動畫（模擬「活著」的感覺） */
.chat-fab.animate-alive {
    animation: fabAlive 2s ease-in-out;
}

@keyframes fabAlive {
    0% { transform: scale(1); }
    15% { transform: scale(1.08) rotate(2deg); }
    30% { transform: scale(1) rotate(-1deg); }
    45% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

/* FAB 呼吸脈衝環 */
.chat-fab::after {
    content: '';
    position: absolute;
    inset: -4px;
    border-radius: 50%;
    border: 2px solid rgba(255,183,221,0.35);
    opacity: 0;
    animation: fabPulse 3s ease-in-out infinite;
    pointer-events: none;
}

@keyframes fabPulse {
    0%, 100% { opacity: 0; transform: scale(1); }
    50% { opacity: 0.4; transform: scale(1.15); }
}

.chat-window {
    position: fixed;
    bottom: 80px;
    right: 20px;
    width: 400px;
    height: 550px;
    min-height: 300px;
    max-height: calc(100vh - 100px);
    background: white;
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-xl);
    display: flex;
    flex-direction: column;
    opacity: 0;
    visibility: hidden;
    transform: scale(0.9) translateY(20px);
    transition: opacity 0.3s, visibility 0.3s, transform 0.3s, right 0.3s ease;
    z-index: 1000;
}

.chat-window.dragging {
    transition: none;
    user-select: none;
}

/* 鍵盤開啟時（手機 + iPad / 平板共用） */
.chat-window.keyboard-open {
    overflow: hidden;
    transition: none;
}

.chat-window.keyboard-open .chat-body {
    padding-bottom: 60px;
}

.chat-window.snapped {
    border-radius: 0 0 var(--border-radius-lg) var(--border-radius-lg);
}

.chat-window.snapped .chat-header {
    border-radius: 0;
}

.chat-window.snapped .chat-footer {
    border-radius: 0 0 var(--border-radius-lg) var(--border-radius-lg);
}

/* 停靠模式：緊貼助理面板左側 */
.chat-window.docked {
    border-radius: 12px 0 0 12px;
}

.chat-window.docked .chat-header {
    border-radius: 12px 0 0 0;
}

.chat-window.docked .chat-footer {
    border-radius: 0 0 0 12px;
}

.chat-window.active {
    opacity: 1;
    visibility: visible;
    transform: scale(1) translateY(0);
}

.chat-header {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    padding: 20px;
    border-radius: var(--border-radius-lg) var(--border-radius-lg) 0 0;
    text-align: center;
    position: relative;
    cursor: move;
}

/* 高度調整把手 - 在對話框頂部 */
.chat-resize-handle {
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 60px;
    height: 6px;
    cursor: ns-resize;
    z-index: 10;
}

.chat-resize-handle::before {
    content: '';
    position: absolute;
    top: 2px;
    left: 50%;
    transform: translateX(-50%);
    width: 40px;
    height: 4px;
    background: rgba(255, 255, 255, 0.4);
    border-radius: 2px;
    transition: background 0.2s;
}

.chat-resize-handle:hover::before {
    background: rgba(255, 255, 255, 0.7);
}

.chat-close {
    position: absolute;
    top: 15px;
    right: 15px;
    background: rgba(255, 255, 255, 0.2);
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    color: white;
    font-size: 1.2rem;
    cursor: pointer;
    transition: var(--transition);
}

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

/* 調整視窗大小按鈕 — 僅在平板顯示，位於關閉按鈕正下方 */
.chat-resize-toggle {
    display: none;
    position: absolute;
    top: 52px;
    right: 15px;
    background: rgba(255, 255, 255, 0.2);
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    color: white;
    font-size: 0.85rem;
    cursor: pointer;
    transition: var(--transition);
    z-index: 5;
    align-items: center;
    justify-content: center;
}

.chat-resize-toggle:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* 平板（> 768px 且為觸控裝置）時顯示 — 由 JS 控制加 class */
.chat-window.show-resize-toggle .chat-resize-toggle {
    display: flex;
}

/* === iPad / 平板：聊天視窗預設滿版 === */
.chat-window.tablet-fullscreen {
    width: 100% !important;
    height: 100vh !important;
    height: 100dvh !important;
    max-height: none !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    border-radius: 0 !important;
}

.chat-window.tablet-fullscreen .chat-header {
    border-radius: 0;
}

.chat-window.tablet-fullscreen .chat-footer {
    border-radius: 0;
}

/* iPad / 平板：縮小模式（約 3/5 螢幕高度，置中偏下） */
.chat-window.tablet-compact {
    width: 420px !important;
    height: 60vh !important;
    max-height: none !important;
    top: auto !important;
    left: auto !important;
    right: 20px !important;
    bottom: 80px !important;
    border-radius: var(--border-radius-lg) !important;
}

.chat-window.tablet-compact .chat-header {
    border-radius: var(--border-radius-lg) var(--border-radius-lg) 0 0;
}

.chat-window.tablet-compact .chat-footer {
    border-radius: 0 0 var(--border-radius-lg) var(--border-radius-lg);
}

.chat-avatar {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    border: 3px solid white;
    margin: 0 auto 10px;
    background: white;
    overflow: hidden;
    position: relative;
}

.chat-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* 聊天視窗頭像嘴型動畫影片（手機版 AI 回覆時播放） */
.chat-avatar-video {
    display: none;
    width: 100%;
    height: 100%;
    object-fit: cover;
    position: absolute;
    top: 0;
    left: 0;
    border-radius: 50%;
}

.chat-avatar .pulse-ring {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.4);
    opacity: 0;
}

.chat-avatar.speaking .pulse-ring {
    animation: pulse-animation 1.5s infinite;
}

/* 手機/平板版 AI 回覆時頭像放大動畫 — 放大 3 倍移至藍色 header 中央 */
/* transform 由 JS 動態計算（translateY + scale(3)），確保圓心對準「你的 AI 數位助理」 */
.chat-avatar.video-enlarged {
    z-index: 100;
    border-color: rgba(255, 255, 255, 0.9);
    box-shadow: 0 0 30px rgba(242, 120, 75, 0.5);
    transition: transform 0.5s cubic-bezier(0.34, 1.56, 0.64, 1),
                box-shadow 0.5s ease,
                border-color 0.5s ease;
}

/* 未放大時的回彈過渡（比放大快，體感更俐落） */
.chat-avatar.video-shrinking {
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1),
                box-shadow 0.3s ease,
                border-color 0.3s ease;
}

/* 放大時隱藏脈衝環（避免放大後脈衝環位置錯亂） */
.chat-avatar.video-enlarged .pulse-ring {
    display: none;
}

.chat-avatar.listening .pulse-ring {
    animation: pulse-animation 1s infinite;
    background: rgba(232, 133, 123, 0.4);
}

@keyframes pulse-animation {
    0% { width: 100%; height: 100%; opacity: 0.8; }
    100% { width: 140%; height: 140%; opacity: 0; }
}

.chat-header h3 {
    color: white;
    font-size: 1.1rem;
    margin-bottom: 5px;
}

.chat-header p {
    color: rgba(255, 255, 255, 0.8);
    font-size: 0.85rem;
}

.mic-btn {
    margin-top: 10px;
    width: 58px;              /* 樂齡：放大麥克風（語音優先） */
    height: 58px;
    border-radius: 50%;
    background: white;
    border: none;
    color: var(--primary-color);
    font-size: 1.2rem;
    cursor: pointer;
    transition: var(--transition);
}

.mic-btn:hover {
    transform: scale(1.1);
}

.mic-btn.active {
    background: var(--secondary-color);
    color: white;
    animation: pulse-red 1s infinite;
}

@keyframes pulse-red {
    0% { box-shadow: 0 0 0 0 rgba(232, 133, 123, 0.7); }
    70% { box-shadow: 0 0 0 10px rgba(232, 133, 123, 0); }
    100% { box-shadow: 0 0 0 0 rgba(232, 133, 123, 0); }
}

.chat-body {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 15px;
    background: var(--bg-color);
}

.chat-message {
    max-width: 85%;
    padding: 12px 16px;
    border-radius: 16px;
    /* 字體大小可由使用者透過對話框右上 A-/A+ 按鈕調整（4 級：1.0 / 1.15 / 1.3 / 1.45）
       存進 localStorage.jennie_chat_font_scale，預設 1（即 0.9rem）
       chatBody 上會 set --chat-font-scale，所有訊息卡片繼承此 var */
    font-size: calc(0.9rem * var(--chat-font-scale, 1));
    line-height: 1.5;
}

/* 所有訊息卡片類型都跟著字體 scale 一起變大 / 縮小
   每個 class 各自的 base 大小不同，所以各自 calc。
   子元素（.care-label / .bk-insight-stats）已改用 em，會自動跟著父元素 scale */
#chatBody .care-message,
#chatBody .bk-insight-card {
    font-size: calc(14px * var(--chat-font-scale, 1));  /* base 14px */
}
#chatBody .bk-chat-notification {
    font-size: calc(0.82rem * var(--chat-font-scale, 1));  /* base 0.82rem */
}
#chatBody .cal-chat-notification,
#chatBody .cal-reminder-card {
    font-size: calc(13px * var(--chat-font-scale, 1));  /* base 13px */
}

.chat-message.bot {
    align-self: flex-start;
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 16px 16px 16px 4px;
}

.chat-message.user {
    align-self: flex-end;
    background: var(--primary-color);
    color: white;
    border-radius: 16px 16px 4px 16px;
}

/* SSE 串流回應 — 閃爍游標 */
.chat-message.streaming {
    white-space: pre-wrap;
    word-break: break-word;
}
.chat-message.streaming .stream-content {
    white-space: pre-wrap;
}
.stream-cursor {
    display: inline;
    animation: blink-cursor 0.6s step-end infinite;
    color: var(--primary-color);
    font-weight: bold;
}
@keyframes blink-cursor {
    50% { opacity: 0; }
}

.typing-indicator {
    align-self: flex-start;
    background: white;
    padding: 12px 16px;
    border-radius: 16px;
    display: none;
}

.typing-indicator.show {
    display: flex;
    gap: 5px;
}

.typing-indicator span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--text-light);
    animation: typing 1.4s infinite both;
}

.typing-indicator span:nth-child(2) { animation-delay: 0.2s; }
.typing-indicator span:nth-child(3) { animation-delay: 0.4s; }

@keyframes typing {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-5px); }
}

.chat-footer {
    padding: 15px;
    border-top: 1px solid var(--border-color);
    display: flex;
    gap: 10px;
    background: white;
    border-radius: 0 0 var(--border-radius-lg) var(--border-radius-lg);
}

.chat-input-wrapper {
    flex: 1;
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 6px 4px 10px;
    border: 1px solid var(--border-color);
    border-radius: 25px;
    background: white;
    transition: var(--transition);
    position: relative;
}

.chat-input-wrapper:focus-within {
    border-color: var(--primary-color);
}

.chat-input {
    flex: 1;
    padding: 8px 10px;
    border: none;
    border-radius: 0;
    font-size: 1.05rem;      /* 樂齡：放大輸入字級 */
    outline: none;
    font-size: 0.9rem;
    background: transparent;
    min-width: 0;
}

.chat-input:focus {
    border-color: transparent;
}

/* === 檔案 @mention 標籤 === */
.file-mention-tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    background: #fff1e8;
    color: var(--primary-color);
    border-radius: 14px;
    font-size: 0.8rem;
    font-weight: 500;
    white-space: nowrap;
    max-width: 40%;
    min-width: 0;
    overflow: hidden;
}

.file-mention-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.file-mention-remove {
    cursor: pointer;
    font-size: 0.65rem;
    opacity: 0.6;
    transition: opacity 0.2s;
    padding: 2px;
}

.file-mention-remove:hover {
    opacity: 1;
}

/* === 檔案 @mention 下拉選單 === */
.file-mention-dropdown {
    display: none;
    position: absolute;
    bottom: calc(100% + 6px);
    left: 0;
    right: 0;
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.12);
    max-height: 220px;
    overflow-y: auto;
    z-index: 100;
}

.file-mention-dropdown.active {
    display: block;
}

.file-mention-header {
    padding: 10px 14px 6px;
    font-size: 0.75rem;
    color: var(--text-light);
    font-weight: 500;
}

.file-mention-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    cursor: pointer;
    transition: background 0.15s;
    font-size: 0.85rem;
    color: var(--text-primary);
}

.file-mention-item:last-child {
    border-radius: 0 0 12px 12px;
}

.file-mention-item:hover,
.file-mention-item.active {
    background: #F1F5F9;
}

.file-mention-item i {
    color: var(--primary-color);
    font-size: 0.9rem;
    width: 20px;
    text-align: center;
    flex-shrink: 0;
}

.file-mention-item span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.file-mention-empty {
    padding: 14px;
    text-align: center;
    color: var(--text-light);
    font-size: 0.85rem;
}

.chat-send {
    width: 45px;
    height: 45px;
    min-width: 45px;
    flex-shrink: 0;
    border-radius: 50%;
    background: var(--primary-color);
    border: none;
    color: white;
    font-size: 1rem;
    cursor: pointer;
    transition: var(--transition);
}

.chat-send:hover {
    background: var(--primary-dark);
}

/* === 聊天工具列（靜音 & 清空） === */
.chat-toolbar {
    position: absolute;
    top: 15px;
    left: 10px;
    display: flex;
    gap: 5px;
    z-index: 2;
}

/* 右側 toolbar（字體縮放按鈕用，鏡像左側 toolbar）
   close 按鈕在 right:15px 寬 32px，所以這個 toolbar 要從 right:55px 開始
   （32 + 15 + 8 buffer），避免跟 ×（關閉）按鈕重疊 */
.chat-toolbar.chat-toolbar-right {
    left: auto;
    right: 55px;
}

/* 字體縮放按鈕 disabled 視覺（已到最大/最小級別時） */
.chat-toolbar-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.chat-toolbar-btn {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    font-size: 0.75rem;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
}

.chat-toolbar-btn:hover {
    background: rgba(255, 255, 255, 0.35);
}

.chat-toolbar-btn.muted {
    background: rgba(255, 80, 80, 0.5);
}

/* === 最近對話紀錄頁面 === */
.chat-history-lock {
    display: flex;
    justify-content: center;
    padding: 60px 20px;
}

.lock-card {
    text-align: center;
    padding: 40px;
    background: white;
    border-radius: 16px;
    border: 1px solid var(--border-color);
    max-width: 400px;
}

.lock-card i {
    font-size: 2.5rem;
    color: var(--text-light);
    margin-bottom: 16px;
}

.lock-card h3 {
    font-size: 1.2rem;
    margin-bottom: 8px;
    color: var(--text-primary);
}

.lock-card p {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 20px;
}

.chat-history-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.chat-history-item {
    padding: 16px 20px;
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    cursor: pointer;
    transition: var(--transition);
}

.chat-history-item:hover {
    border-color: var(--primary-color);
    box-shadow: 0 2px 8px rgba(242, 120, 75, 0.1);
}

.chat-history-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.chat-history-item-time {
    font-size: 0.8rem;
    color: var(--text-light);
}

.chat-history-item-persona {
    font-size: 0.75rem;
    padding: 2px 8px;
    border-radius: 10px;
    background: #fff1e8;
    color: var(--primary-color);
}

.chat-history-item-question {
    font-size: 0.9rem;
    color: var(--text-primary);
    font-weight: 500;
    margin-bottom: 6px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.chat-history-item-preview {
    font-size: 0.85rem;
    color: var(--text-secondary);
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.chat-history-back {
    margin-bottom: 16px;
}

.chat-history-detail-content {
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    overflow: hidden;
}

.chat-history-detail-msg {
    padding: 16px 20px;
}

.chat-history-detail-msg + .chat-history-detail-msg {
    border-top: 1px solid var(--border-color);
}

.chat-history-detail-msg.user {
    background: #F8FAFC;
}

.chat-history-detail-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--primary-color);
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.chat-history-detail-msg.bot .chat-history-detail-label {
    color: #e8857b;
}

.chat-history-detail-text {
    font-size: 0.9rem;
    color: var(--text-primary);
    line-height: 1.6;
    white-space: pre-wrap;
    word-break: break-word;
}

.chat-history-empty {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-light);
}

.chat-history-empty i {
    font-size: 3rem;
    margin-bottom: 16px;
    display: block;
}

/* === 複製按鈕（bot 訊息下方） === */
.copy-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    background: var(--bg-color);
    color: var(--text-light);
    font-size: 0.75rem;
    cursor: pointer;
    transition: var(--transition);
}

.copy-btn:hover {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.copy-btn.copied {
    background: #3fa796;
    color: white;
    border-color: #3fa796;
}

/* === 訊息按鈕群組（複製 + LINE） === */
.msg-btn-group {
    display: flex;
    gap: 6px;
    margin-top: 8px;
}

/* === LINE 分享按鈕 === */
.line-share-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border: 1px solid #06C755;
    border-radius: 12px;
    background: white;
    color: #06C755;
    font-size: 0.75rem;
    cursor: pointer;
    transition: var(--transition);
}

.line-share-btn:hover {
    background: #06C755;
    color: white;
}

.line-share-btn.copied {
    background: #3fa796;
    color: white;
    border-color: #3fa796;
}

/* === 微信分享按鈕 === */
.wechat-share-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border: 1px solid #07C160;
    border-radius: 12px;
    background: white;
    color: #07C160;
    font-size: 0.75rem;
    cursor: pointer;
    transition: var(--transition);
}

.wechat-share-btn:hover {
    background: #07C160;
    color: white;
}

.wechat-share-btn.copied {
    background: #3fa796;
    color: white;
    border-color: #3fa796;
}

/* === 截圖按鈕 === */
.screenshot-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border: 1px solid #f2784b;
    border-radius: 12px;
    background: white;
    color: #f2784b;
    font-size: 0.75rem;
    cursor: pointer;
    transition: var(--transition);
}

.screenshot-btn:hover {
    background: #f2784b;
    color: white;
}

.screenshot-btn.copied {
    background: #3fa796;
    color: white;
    border-color: #3fa796;
}

.screenshot-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

/* === 滑到底部浮動按鈕 === */
.scroll-bottom-btn {
    position: absolute;
    bottom: 75px;
    left: 50%;
    transform: translateX(-50%) scale(0);
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--primary-color);
    border: none;
    color: white;
    font-size: 0.9rem;
    cursor: pointer;
    transition: transform 0.2s ease, background 0.2s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
}

.scroll-bottom-btn.visible {
    transform: translateX(-50%) scale(1);
    opacity: 1;
    pointer-events: auto;
}

.scroll-bottom-btn:hover {
    background: var(--primary-dark);
}

/* 靜音模式下的麥克風按鈕 */
.mic-btn.muted-style {
    background: #ccc;
    color: #888;
    cursor: not-allowed;
    position: relative;
}

.mic-btn.muted-style::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 2px;
    height: 60%;
    background: #e74c3c;
    transform: translate(-50%, -50%) rotate(45deg);
    border-radius: 1px;
}

/* === 聊天專用模式（圖釘獨立視窗） === */
.chat-only-mode .app-container,
.chat-only-mode .auth-overlay,
.chat-only-mode .chat-fab,
.chat-only-mode .assistant-panel {
    display: none !important;
}

.chat-only-mode {
    margin: 0 !important;
    padding: 0 !important;
    overflow: hidden;
    width: 100vw;
    height: 100vh;
    height: 100dvh;
}

.chat-only-mode .chat-window {
    border-radius: 0 !important;
    box-shadow: none !important;
    border: none !important;
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    height: 100dvh !important;
    max-height: 100vh !important;
    max-height: 100dvh !important;
    max-width: 100vw !important;
    margin: 0 !important;
    transform: none !important;
}

.chat-only-mode .chat-header {
    border-radius: 0;
}

.chat-only-mode .chat-footer {
    border-radius: 0;
    padding-bottom: calc(15px + env(safe-area-inset-bottom, 0px));
}

/* === 手機版側邊欄開關 === */

/* 桌面版隱藏 toggle 相關元素 */
.mobile-sidebar-toggle,
.mobile-sidebar-close,
.sidebar-backdrop {
    display: none;
}

/* === 響應式設計 === */
@media (max-width: 768px) {
    /* 漢堡選單按鈕 - 固定在左上角 */
    .mobile-sidebar-toggle {
        display: flex;
        align-items: center;
        justify-content: center;
        position: fixed;
        top: 12px;
        left: 12px;
        z-index: 200;
        width: 42px;
        height: 42px;
        border-radius: 12px;
        border: 1px solid var(--border-color);
        background: white;
        box-shadow: 0 2px 12px rgba(0,0,0,0.1);
        color: var(--text-primary);
        font-size: 1.1rem;
        cursor: pointer;
        transition: all 0.2s ease;
    }

    .mobile-sidebar-toggle:active {
        transform: scale(0.92);
        background: var(--bg-color);
    }

    /* sidebar open 時隱藏 toggle */
    .sidebar.open ~ .main-content .mobile-sidebar-toggle,
    .mobile-sidebar-toggle.hidden {
        opacity: 0;
        pointer-events: none;
    }

    /* 關閉按鈕 - sidebar 內 header 右側 */
    .mobile-sidebar-close {
        display: flex;
        align-items: center;
        justify-content: center;
        width: 34px;
        height: 34px;
        border-radius: 8px;
        border: none;
        background: var(--bg-color);
        color: var(--text-secondary);
        font-size: 1.1rem;
        cursor: pointer;
        margin-left: auto;
        transition: all 0.2s ease;
    }

    .mobile-sidebar-close:active {
        background: rgba(242, 120, 75, 0.1);
        color: var(--primary-color);
    }

    /* 背景遮罩 */
    .sidebar-backdrop {
        display: block;
        position: fixed;
        inset: 0;
        z-index: 99;
        background: rgba(0, 0, 0, 0.5);
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.3s ease;
        -webkit-backdrop-filter: blur(2px);
        backdrop-filter: blur(2px);
    }

    .sidebar-backdrop.active {
        opacity: 1;
        pointer-events: auto;
    }

    /* Sidebar 覆蓋效果 */
    .sidebar {
        transform: translateX(-100%);
        box-shadow: none;
        z-index: 300;
    }

    .sidebar.open {
        transform: translateX(0);
        box-shadow: 4px 0 24px rgba(0,0,0,0.15);
    }

    .main-content {
        margin-left: 0;
        padding: 15px;
        padding-top: 64px; /* 為 toggle 按鈕留空間 */
        overflow-x: hidden;
    }

    .settings-section {
        padding: 15px;
    }

    .avatar-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 10px;
    }

    .gender-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 10px;
    }

    .chat-window {
        width: 100%;
        max-width: 100vw;
        height: 100vh;
        height: 100dvh;
        bottom: 0;
        right: 0;
        left: 0;
        border-radius: 0;
        max-height: none;
        overflow: hidden;
    }

    .chat-window.active {
        transform: none;
    }

    .chat-footer {
        flex-shrink: 0;
        padding-bottom: calc(15px + env(safe-area-inset-bottom, 0px));
    }

    /* 防止 iOS Safari 對 font-size < 16px 的 input 自動縮放 */
    .chat-input {
        font-size: 16px;
    }

    .file-mention-tag {
        max-width: 130px;
    }

    .chat-container.active .chat-fab {
        display: none;
    }
}

/* === 頁面切換動畫 === */
.page {
    display: none;
    animation: fadeIn 0.3s ease;
}

.page.active {
    display: block;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* === 載入動畫 === */
.loading {
    display: inline-flex;
    align-items: center;
    gap: 10px;
}

.loading .spinner {
    width: 20px;
    height: 20px;
    border: 2px solid var(--border-color);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* === Toast 通知 === */
.toast {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: var(--text-primary);
    color: white;
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 0.9rem;
    opacity: 0;
    transition: var(--transition);
    z-index: 9999;
}

.toast.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

.toast.success {
    background: var(--accent-color);
}

.toast.error {
    background: #EF4444;
}

/* === 數位助理側邊面板 === */
.assistant-panel {
    position: fixed;
    top: 0;
    right: 0;
    width: 280px;
    height: 100vh;
    background: linear-gradient(180deg, #1a1a2e 0%, #16213e 100%);
    z-index: 900;
    display: flex;
    flex-direction: column;
    transition: width 0.3s ease, transform 0.3s ease;
    box-shadow: -4px 0 20px rgba(0, 0, 0, 0.3);
}

.assistant-panel.collapsed {
    transform: translateX(calc(100% - 40px));
}

.assistant-panel.resizing {
    transition: none;
}

/* 寬度調整把手 */
.assistant-panel-resize {
    position: absolute;
    top: 0;
    left: 0;
    width: 6px;
    height: 100%;
    cursor: ew-resize;
    background: transparent;
    z-index: 10;
}

.assistant-panel-resize:hover,
.assistant-panel-resize:active {
    background: linear-gradient(180deg, var(--primary-color) 0%, var(--primary-dark) 100%);
}

/* 面板內容區 — 樣式已移至全身照片動畫區塊 */

/* 全身照片 */
.assistant-full-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center top;
    transition: filter 0.5s ease, transform 0.5s ease;
}

/* 全身嘴型動畫影片（AI 回覆時播放） */
.assistant-full-video {
    display: none;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center top;
    position: absolute;
    top: 0;
    left: 0;
}

/* 助理頭像生命感動畫 */
.assistant-panel-content {
    flex: 1;
    display: flex;
    align-items: stretch;
    justify-content: center;
    overflow: hidden;
    position: relative;
}

/* 光澤掃過效果的遮罩 */
.assistant-panel-content::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 60%;
    height: 100%;
    background: linear-gradient(
        105deg,
        transparent 30%,
        rgba(255, 255, 255, 0.15) 45%,
        rgba(255, 255, 255, 0.25) 50%,
        rgba(255, 255, 255, 0.15) 55%,
        transparent 70%
    );
    pointer-events: none;
    z-index: 1;
    opacity: 0;
}

/* 光澤掃過動畫 */
.assistant-panel-content.animate-alive::after {
    animation: shine-sweep 1.2s ease-in-out;
}

/* 呼吸 + 溫暖發光動畫 */
.assistant-panel-content.animate-alive .assistant-full-image {
    animation: breathe-glow 2s ease-in-out;
}

@keyframes shine-sweep {
    0% { left: -100%; opacity: 0; }
    10% { opacity: 1; }
    90% { opacity: 1; }
    100% { left: 120%; opacity: 0; }
}

@keyframes breathe-glow {
    0% { transform: scale(1); filter: brightness(1); }
    30% { transform: scale(1.008); filter: brightness(1.06) saturate(1.1); }
    60% { transform: scale(1.005); filter: brightness(1.03); }
    100% { transform: scale(1); filter: brightness(1) saturate(1); }
}
.assistant-panel-toggle {
    position: absolute;
    left: -20px;
    top: 50%;
    transform: translateY(-50%);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    border: none;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-lg);
    transition: var(--transition);
    z-index: 11;
}

.assistant-panel-toggle:hover {
    transform: translateY(-50%) scale(1.1);
    box-shadow: var(--shadow-xl);
}

.assistant-panel.collapsed .assistant-panel-toggle i {
    transform: rotate(180deg);
}

/* 調整主內容區域，為助理面板留出空間 */
.app-container {
    margin-right: 280px;
    transition: margin-right 0.3s ease;
}

.assistant-panel.collapsed ~ .app-container,
body.assistant-panel-collapsed .app-container {
    margin-right: 40px;
}

/* 調整聊天容器位置 */
.chat-container {
    right: 300px;
    transition: right 0.3s ease;
}

.assistant-panel.collapsed ~ .chat-container,
body.assistant-panel-collapsed .chat-container {
    right: 60px;
}

/* ============================================
   企業版 - 購買者提示
   ============================================ */
.enterprise-purchaser-hint {
    font-size: 0.82rem;
    color: #666;
    margin: 0.5rem 0 0.8rem;
    padding: 0 0.5rem;
}
.enterprise-purchaser-hint i {
    color: var(--primary-color, #f2784b);
    margin-right: 4px;
}

/* 企業版每人均攤費用 */
.pricing-per-person {
    font-size: 0.82rem;
    font-weight: 700;
    color: #DC2626;
    margin-top: 6px;
    min-height: 1.2em;
    letter-spacing: 0.3px;
}

/* ============================================
   企業邀請碼 & 團隊管理
   ============================================ */

/* 邀請碼列表 */
.invite-codes-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.invite-code-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    border-radius: 8px;
    background: #f8f9fa;
    border: 1px solid #e9ecef;
}
.invite-code-item.status-available { border-left: 3px solid #22c55e; }
.invite-code-item.status-redeemed { border-left: 3px solid #f2784b; background: #f5f3ff; }
.invite-code-item.status-expired { border-left: 3px solid #aaa; background: #f3f3f3; opacity: 0.7; }

.invite-code-value {
    display: flex;
    align-items: center;
    gap: 8px;
}
.invite-code-value code {
    font-size: 1rem;
    font-weight: 600;
    letter-spacing: 2px;
    color: #333;
    background: #fff;
    padding: 4px 10px;
    border-radius: 6px;
    border: 1px solid #ddd;
}
.invite-code-copy-btn {
    background: none;
    border: none;
    color: #f2784b;
    cursor: pointer;
    font-size: 0.9rem;
    padding: 4px 6px;
    border-radius: 4px;
}
.invite-code-copy-btn:hover { background: #fff1e8; }

.invite-code-status {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.82rem;
}
.invite-code-badge {
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 500;
}
.invite-code-badge.status-available { background: #dcfce7; color: #15803d; }
.invite-code-badge.status-redeemed { background: #fff1e8; color: #e0633a; }
.invite-code-badge.status-expired { background: #f3f4f6; color: #6b7280; }

.invite-code-redeemed-by {
    color: #666;
    font-size: 0.8rem;
}

/* 邀請碼彈窗 */
.invite-codes-display {
    max-height: 300px;
    overflow-y: auto;
    text-align: left;
}

/* 團隊摘要卡片 */
.team-summary-cards {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    margin-bottom: 20px;
}
.team-summary-card {
    background: #fff;
    border-radius: 10px;
    padding: 16px;
    text-align: center;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
    border: 1px solid #eee;
}
.team-summary-value {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--primary-color, #f2784b);
}
.team-summary-label {
    font-size: 0.8rem;
    color: #888;
    margin-top: 4px;
}

/* 團隊成員列表 */
.team-members-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.team-member-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-radius: 8px;
    background: #fff;
    border: 1px solid #e9ecef;
}
.team-member-item.member-disabled {
    background: #f9f9f9;
    opacity: 0.7;
}
.team-member-info { flex: 1; }
.team-member-name {
    font-weight: 600;
    font-size: 0.95rem;
    color: #333;
}
.team-member-email {
    font-size: 0.8rem;
    color: #888;
    margin-top: 2px;
}
.admin-badge {
    font-size: 0.7rem;
    background: linear-gradient(135deg, #f2784b, #f2784b);
    color: #fff;
    padding: 2px 8px;
    border-radius: 10px;
    margin-left: 6px;
    font-weight: 500;
}
.team-member-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}
.team-member-status {
    font-size: 0.8rem;
    font-weight: 500;
}
.team-member-status.member-active { color: #22c55e; }
.team-member-status.member-disabled { color: #999; }

.btn-sm {
    font-size: 0.78rem;
    padding: 4px 10px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 500;
}

@media (max-width: 600px) {
    .team-summary-cards { grid-template-columns: repeat(2, 1fr); }
    .team-member-item { flex-direction: column; align-items: flex-start; gap: 8px; }
    .team-member-actions { width: 100%; justify-content: space-between; }
    .invite-code-item { flex-direction: column; align-items: flex-start; gap: 6px; }
}

/* VIP 登入提示 */
.vip-login-hint {
    font-size: 0.85rem;
    color: #888;
    margin-bottom: 1rem;
    text-align: center;
}

/* ============================================
   Onboarding 新手引導
   ============================================ */
.onboarding-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    backdrop-filter: blur(4px);
    animation: onboard-fadein 0.3s ease;
}
@keyframes onboard-fadein {
    from { opacity: 0; }
    to { opacity: 1; }
}
.onboarding-card {
    background: white;
    border-radius: 20px;
    padding: 32px 28px;
    max-width: 440px;
    width: 92%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    text-align: center;
    position: relative;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Onboarding — 縮小浮動模式（Step 2 上傳時） */
.onboarding-overlay.mini-mode {
    background: transparent;
    backdrop-filter: none;
    pointer-events: none;
    align-items: flex-start;
    justify-content: flex-end;
}
.onboarding-overlay.mini-mode .onboarding-card {
    pointer-events: auto;
    max-width: 280px;
    width: auto;
    padding: 18px 20px;
    margin: 20px;
    border-radius: 16px;
    box-shadow: 0 8px 30px rgba(0,0,0,0.18);
    cursor: grab;
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 10001;
}
.onboarding-overlay.mini-mode .onboarding-card:active {
    cursor: grabbing;
}
.onboarding-overlay.mini-mode .onboarding-steps {
    display: none;
}
.onboarding-overlay.mini-mode .onboard-step .onboard-icon,
.onboarding-overlay.mini-mode .onboard-step .onboard-desc,
.onboarding-overlay.mini-mode .onboard-step .onboard-formats,
.onboarding-overlay.mini-mode .onboard-step .onboard-btn-skip {
    display: none;
}
.onboarding-overlay.mini-mode .onboard-step h2 {
    font-size: 1rem;
    margin-bottom: 12px;
}
.onboarding-steps {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-bottom: 24px;
}
.onboarding-step-dot {
    width: 10px; height: 10px;
    border-radius: 50%;
    background: #E5E7EB;
    transition: all 0.3s ease;
}
.onboarding-step-dot.active {
    background: #f2784b;
    transform: scale(1.2);
}
.onboarding-step-dot.done {
    background: #3fa796;
}
.onboard-step {
    display: none;
    animation: onboard-slide 0.3s ease;
}
.onboard-step.active {
    display: block;
}
@keyframes onboard-slide {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: translateY(0); }
}
.onboard-icon {
    margin-bottom: 16px;
}
.onboard-step h2 {
    font-size: 1.4rem;
    margin-bottom: 8px;
    color: #1F2937;
}
.onboard-desc {
    color: #6B7280;
    font-size: 0.95rem;
    margin-bottom: 20px;
    line-height: 1.5;
}
.onboard-hint {
    color: #9CA3AF;
    font-size: 0.8rem;
    margin-bottom: 16px;
}

/* Onboarding — 人格選擇 grid */
.onboard-persona-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin-bottom: 12px;
}
.onboard-persona {
    padding: 12px 8px;
    border: 2px solid #E5E7EB;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}
.onboard-persona .emoji {
    font-size: 1.6rem;
}
.onboard-persona span:last-child {
    font-size: 0.85rem;
    font-weight: 500;
    color: #374151;
}
.onboard-persona:hover {
    border-color: #f3b89a;
    background: #F5F3FF;
}
.onboard-persona.selected {
    border-color: #f2784b;
    background: #fff1e8;
    box-shadow: 0 0 0 3px rgba(242, 120, 75,0.15);
}

/* Onboarding — 支援格式 badges */
.onboard-formats {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
    margin-bottom: 24px;
}
.onboard-formats span {
    background: #F3F4F6;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.82rem;
    color: #4B5563;
    display: flex;
    align-items: center;
    gap: 5px;
}
.onboard-formats span i {
    color: #f2784b;
}

/* Onboarding — 建議問法 */
.onboard-suggestions {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 20px;
    text-align: left;
}
.onboard-suggestion {
    padding: 12px 16px;
    background: #F9FAFB;
    border: 1px solid #E5E7EB;
    border-radius: 12px;
    cursor: pointer;
    font-size: 0.9rem;
    color: #374151;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 10px;
}
.onboard-suggestion i {
    color: #f2784b;
    font-size: 1rem;
    flex-shrink: 0;
}
.onboard-suggestion:hover {
    border-color: #f3b89a;
    background: #fff1e8;
}

/* Onboarding — 按鈕 */
.onboard-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 32px;
    background: linear-gradient(135deg, #f2784b, #f89a77);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    width: 100%;
    justify-content: center;
}
.onboard-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(242, 120, 75,0.3);
}
.onboard-btn-next {
    margin-top: 10px;
    background: white;
    color: #f2784b;
    border: 2px solid #f2784b;
}
.onboard-btn-next:hover {
    background: #fff1e8;
    box-shadow: 0 4px 12px rgba(242, 120, 75,0.15);
}
.onboard-btn-skip {
    display: block;
    width: 100%;
    margin-top: 10px;
    padding: 10px;
    background: none;
    border: none;
    color: #9CA3AF;
    font-size: 0.88rem;
    cursor: pointer;
}
.onboard-btn-skip:hover {
    color: #f2784b;
}

/* VIP 首次登入 Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.modal-card {
    background: white;
    border-radius: 12px;
    padding: 2rem;
    box-shadow: 0 8px 32px rgba(0,0,0,0.2);
}

.modal-card h3 {
    margin: 0 0 0.5rem;
    font-size: 1.2rem;
}

/* 響應式 - 小螢幕隱藏助理面板 */
@media (max-width: 1200px) {
    .assistant-panel {
        display: none;
    }

    .app-container {
        margin-right: 0;
    }

    .chat-container {
        right: 20px;
    }
}


/* ============================================
   聊天室內圖片顯示 & 放大 Lightbox
   ============================================ */

/* 聊天訊息中的圖片 */
.chat-message img {
    max-width: 100%;
    max-height: 300px;
    border-radius: 8px;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    margin: 8px 0;
    border: 1px solid var(--border-color);
}

.chat-message img:hover {
    transform: scale(1.02);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* Lightbox 全螢幕放大 */
.image-lightbox {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.85);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.lightbox-content {
    position: relative;
    max-width: 90vw;
    max-height: 90vh;
}

.lightbox-content img {
    max-width: 90vw;
    max-height: 85vh;
    object-fit: contain;
    border-radius: 8px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
}

.lightbox-close {
    position: absolute;
    top: -40px;
    right: 0;
    background: none;
    border: none;
    color: white;
    font-size: 2rem;
    cursor: pointer;
    padding: 4px 12px;
    line-height: 1;
}

.lightbox-close:hover {
    color: #ccc;
}

/* ============================================
   意見回饋頁面
   ============================================ */

.feedback-form-card,
.feedback-history-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 20px;
}

.feedback-form-card h3,
.feedback-history-card h3 {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-primary);
}

.feedback-form-card h3 i {
    color: var(--primary-color);
}

.feedback-history-card h3 i {
    color: #f2784b;
}

.feedback-form .form-group {
    margin-bottom: 16px;
}

.feedback-form .form-group label {
    display: block;
    font-size: 0.9rem;
    font-weight: 500;
    margin-bottom: 6px;
    color: var(--text-secondary);
}

.feedback-form .form-select {
    width: 100%;
    max-width: 300px;
    padding: 10px 12px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    background: var(--bg-color);
    color: var(--text-primary);
    font-size: 0.95rem;
    outline: none;
}

.feedback-form .form-select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(242, 120, 75, 0.15);
}

.feedback-form .form-textarea {
    width: 100%;
    padding: 12px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    background: var(--bg-color);
    color: var(--text-primary);
    font-size: 0.95rem;
    resize: vertical;
    min-height: 120px;
    font-family: inherit;
    outline: none;
}

.feedback-form .form-textarea:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(242, 120, 75, 0.15);
}

.feedback-submit-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 24px;
    font-size: 0.95rem;
}

/* 回饋歷史列表 */

.feedback-empty,
.feedback-loading {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-muted);
}

.feedback-empty i,
.feedback-loading i {
    font-size: 2.5rem;
    margin-bottom: 12px;
    display: block;
    opacity: 0.4;
}

.feedback-item {
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 16px;
    margin-bottom: 12px;
    background: var(--bg-color);
    transition: box-shadow 0.2s;
}

.feedback-item:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.feedback-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.feedback-category-tag {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 500;
    background: rgba(242, 120, 75, 0.1);
    color: var(--primary-color);
}

.feedback-status {
    font-size: 0.8rem;
    font-weight: 500;
    padding: 3px 10px;
    border-radius: 20px;
    border: 1px solid;
}

.feedback-message {
    font-size: 0.95rem;
    line-height: 1.6;
    color: var(--text-primary);
    margin-bottom: 8px;
    white-space: pre-wrap;
}

.feedback-time {
    font-size: 0.8rem;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 5px;
}

/* 官方回覆 */

.feedback-reply {
    margin-top: 12px;
    padding: 12px 16px;
    background: rgba(34, 197, 94, 0.06);
    border-left: 3px solid #22c55e;
    border-radius: 0 8px 8px 0;
}

.feedback-reply-header {
    font-size: 0.85rem;
    font-weight: 600;
    color: #16a34a;
    margin-bottom: 6px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.feedback-reply-time {
    font-weight: 400;
    color: var(--text-muted);
    margin-left: auto;
    font-size: 0.78rem;
}

.feedback-reply-content {
    font-size: 0.93rem;
    line-height: 1.6;
    color: var(--text-primary);
    white-space: pre-wrap;
}

/* 截圖上傳區 */

.label-hint {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-weight: 400;
}

.screenshot-upload-zone {
    border: 2px dashed #cbd5e1;
    border-radius: 12px;
    padding: 16px;
    transition: border-color 0.2s, background 0.2s;
    min-height: 100px;
}

.screenshot-upload-zone.dragover {
    border-color: var(--primary-color);
    background: rgba(242, 120, 75, 0.04);
}

.screenshot-upload-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    cursor: pointer;
    padding: 12px 0;
    color: var(--text-muted);
}

.screenshot-upload-placeholder i {
    font-size: 2rem;
    color: #94a3b8;
}

.screenshot-upload-placeholder p {
    margin: 0;
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.screenshot-upload-placeholder span {
    font-size: 0.78rem;
    color: #94a3b8;
}

.screenshot-preview-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
    gap: 10px;
}

.screenshot-thumb {
    position: relative;
    border-radius: 8px;
    overflow: hidden;
    aspect-ratio: 1;
    border: 1px solid #e2e8f0;
    cursor: default;
}

.screenshot-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.screenshot-remove-btn {
    position: absolute;
    top: 3px;
    right: 3px;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: rgba(239, 68, 68, 0.85);
    color: #fff;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    transition: background 0.15s;
}

.screenshot-remove-btn:hover {
    background: #dc2626;
}

.screenshot-index {
    position: absolute;
    bottom: 3px;
    left: 3px;
    background: rgba(0,0,0,0.55);
    color: #fff;
    font-size: 0.65rem;
    padding: 1px 6px;
    border-radius: 4px;
}

/* 歷史回饋截圖 */

.feedback-screenshots {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 8px;
}

.feedback-screenshot-thumb {
    width: 64px;
    height: 64px;
    object-fit: cover;
    border-radius: 6px;
    border: 1px solid #e2e8f0;
    cursor: pointer;
    transition: transform 0.15s, box-shadow 0.15s;
}

.feedback-screenshot-thumb:hover {
    transform: scale(1.08);
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

/* 截圖燈箱 */

.screenshot-lightbox {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    cursor: pointer;
}

.screenshot-lightbox img {
    max-width: 90vw;
    max-height: 85vh;
    object-fit: contain;
    border-radius: 8px;
    box-shadow: 0 8px 30px rgba(0,0,0,0.4);
}

.screenshot-lightbox-close {
    position: absolute;
    top: 16px;
    right: 20px;
    color: #fff;
    font-size: 2rem;
    cursor: pointer;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: rgba(255,255,255,0.1);
    transition: background 0.15s;
}

.screenshot-lightbox-close:hover {
    background: rgba(255,255,255,0.25);
}

/* ============================================
   PWA 安裝提示
   ============================================ */

.pwa-install-banner {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 10000;
    background: linear-gradient(135deg, #1a1a2e, #16213e);
    border-top: 2px solid var(--primary);
    padding: 14px 20px;
    align-items: center;
    justify-content: center;
    animation: pwaSlideUp 0.4s ease;
    box-shadow: 0 -4px 20px rgba(0,0,0,0.4);
}

@keyframes pwaSlideUp {
    from { transform: translateY(100%); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.pwa-install-content {
    display: flex;
    align-items: center;
    gap: 14px;
    max-width: 600px;
    width: 100%;
}

.pwa-install-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    flex-shrink: 0;
}

.pwa-install-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
    flex: 1;
    min-width: 0;
}

.pwa-install-text strong {
    font-size: 0.95rem;
    color: #fff;
}

.pwa-install-text span {
    font-size: 0.8rem;
    color: rgba(255,255,255,0.6);
}

.pwa-install-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.pwa-install-btn {
    background: var(--primary);
    color: #fff;
    border: none;
    padding: 8px 20px;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.pwa-install-btn:hover {
    background: var(--primary-hover);
    transform: scale(1.05);
}

.pwa-dismiss-btn {
    background: none;
    border: none;
    color: rgba(255,255,255,0.4);
    font-size: 1.3rem;
    cursor: pointer;
    padding: 4px 8px;
    line-height: 1;
    transition: color 0.2s;
}

.pwa-dismiss-btn:hover {
    color: rgba(255,255,255,0.8);
}

/* iOS PWA Guide */
.pwa-ios-guide {
    display: none;
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10000;
    animation: pwaSlideUp 0.4s ease;
}

.pwa-ios-content {
    background: linear-gradient(135deg, #1a1a2e, #16213e);
    border: 1px solid rgba(108, 92, 231, 0.4);
    border-radius: 16px;
    padding: 20px 24px;
    text-align: center;
    max-width: 320px;
    box-shadow: 0 8px 30px rgba(0,0,0,0.5);
    position: relative;
    color: #fff;
}

.pwa-ios-content .pwa-dismiss-btn {
    position: absolute;
    top: 8px;
    right: 10px;
}

.pwa-ios-content .pwa-install-icon {
    width: 56px;
    height: 56px;
    margin: 0 auto 10px;
    display: block;
}

.pwa-ios-content p {
    margin: 6px 0;
    font-size: 0.88rem;
    line-height: 1.5;
    color: rgba(255,255,255,0.8);
}

.pwa-ios-content p strong {
    color: #fff;
}

.pwa-ios-content i {
    color: var(--primary);
}

/* Arrow pointing down for iOS guide */
.pwa-ios-content::after {
    content: '';
    position: absolute;
    bottom: -10px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 10px solid transparent;
    border-right: 10px solid transparent;
    border-top: 10px solid #16213e;
}

/* Mobile responsive */
@media (max-width: 480px) {
    .pwa-install-banner {
        padding: 12px 14px;
    }
    .pwa-install-icon {
        width: 40px;
        height: 40px;
    }
    .pwa-install-text strong {
        font-size: 0.88rem;
    }
    .pwa-install-text span {
        font-size: 0.75rem;
    }
    .pwa-install-btn {
        padding: 7px 14px;
        font-size: 0.82rem;
    }
}

/* ============================================
   用量總覽頁面 (Usage Dashboard)
   ============================================ */

.usage-dashboard {
    max-width: 700px;
}

.usage-loading {
    text-align: center;
    padding: 40px;
    color: var(--text-secondary);
    font-size: 1rem;
}

/* --- 方案資訊卡片 --- */
.usage-plan-card {
    padding: 20px 25px;
    margin-bottom: 20px;
}

.usage-plan-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 8px;
}

.usage-plan-badge {
    display: inline-block;
    padding: 5px 16px;
    border-radius: 20px;
    font-size: 0.95rem;
    font-weight: 600;
    color: white;
    background: linear-gradient(135deg, #f2784b, #f89a77);
}

.usage-plan-badge.tier-free {
    background: linear-gradient(135deg, #94A3B8, #CBD5E1);
    color: #475569;
}

.usage-plan-badge.tier-standard {
    background: linear-gradient(135deg, #f2784b, #f89a77);
}

.usage-plan-badge.tier-pro {
    background: linear-gradient(135deg, #F59E0B, #FBBF24);
    color: #78350F;
}

.usage-plan-badge.tier-enterprise {
    background: linear-gradient(135deg, #e8857b, #f0a59c);
}

.usage-plan-billing {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.usage-plan-expires {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

/* --- 用量進度條卡片 --- */
.usage-meters {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
    margin-bottom: 20px;
}

.usage-meter-card {
    padding: 20px;
}

.usage-meter-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}

.usage-meter-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1rem;
    flex-shrink: 0;
}

.usage-meter-header h3 {
    font-size: 1rem;
    margin-bottom: 2px;
}

.usage-meter-subtitle {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin: 0;
}

.usage-meter-numbers {
    display: flex;
    align-items: baseline;
    gap: 4px;
    margin-bottom: 10px;
}

.usage-meter-used {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--text-primary);
}

.usage-meter-separator {
    font-size: 1.2rem;
    color: var(--text-secondary);
}

.usage-meter-limit {
    font-size: 1.2rem;
    color: var(--text-secondary);
}

.usage-progress-bar {
    width: 100%;
    height: 8px;
    background: var(--bg-secondary);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 8px;
}

.usage-progress-fill {
    height: 100%;
    border-radius: 4px;
    background: linear-gradient(90deg, #f2784b, #f89a77);
    transition: width 0.6s ease;
}

.usage-progress-fill.usage-progress-green {
    background: linear-gradient(90deg, #3fa796, #6cc0ad);
}

.usage-progress-fill.usage-progress-warning {
    background: linear-gradient(90deg, #F59E0B, #FBBF24);
}

.usage-progress-fill.usage-progress-danger {
    background: linear-gradient(90deg, #EF4444, #F87171);
}

.usage-meter-remaining {
    font-size: 0.82rem;
    color: var(--text-secondary);
    margin: 0;
}

/* --- 功能解鎖 --- */
.usage-features-card {
    padding: 20px;
    margin-bottom: 20px;
}

.usage-features-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
}

.usage-feature-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9rem;
    color: var(--text-primary);
}

.usage-feature-item i {
    width: 20px;
    text-align: center;
    font-size: 0.9rem;
}

.usage-feature-item i.feature-unlocked {
    color: #3fa796;
}

.usage-feature-item i.feature-locked {
    color: var(--text-secondary);
    opacity: 0.5;
}

.usage-feature-item .feature-locked-text {
    color: var(--text-secondary);
    opacity: 0.6;
    text-decoration: line-through;
}

/* --- 升級 CTA --- */
.usage-upgrade-cta {
    margin-bottom: 20px;
}

.usage-upgrade-inner {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 20px 24px;
    border-radius: var(--radius);
    background: linear-gradient(135deg, #fff1e8, #ffe6da);
    border: 1px solid #f7d3bf;
}

.usage-upgrade-inner > i {
    font-size: 1.5rem;
    color: #f2784b;
    flex-shrink: 0;
}

.usage-upgrade-inner > div {
    flex: 1;
}

.usage-upgrade-inner h3 {
    font-size: 0.95rem;
    margin-bottom: 4px;
    color: #312E81;
}

.usage-upgrade-inner p {
    font-size: 0.82rem;
    color: #c9542e;
    margin: 0;
}

.usage-upgrade-inner .btn {
    flex-shrink: 0;
}

/* --- 帳號資訊 --- */
.usage-account-card {
    padding: 20px;
}

.usage-account-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 16px;
}

.usage-account-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.usage-account-label {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.usage-account-value {
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--text-primary);
}

/* --- 手機版適配 --- */
@media (max-width: 768px) {
    .usage-meters {
        grid-template-columns: 1fr;
    }
    .usage-upgrade-inner {
        flex-direction: column;
        text-align: center;
    }
    .usage-account-grid {
        grid-template-columns: 1fr 1fr;
    }
}

/* ============================================
   Email 驗證提示覆蓋層
   ============================================ */

.email-verify-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(255, 255, 255, 0.82);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}
.email-verify-overlay.hidden {
    display: none;
}
.email-verify-card {
    background: white;
    border-radius: 16px;
    padding: 40px 32px;
    max-width: 440px;
    width: 100%;
    text-align: center;
    box-shadow: 0 8px 40px rgba(242, 120, 75, 0.18), 0 2px 12px rgba(0,0,0,0.08);
    border: 1px solid rgba(242, 120, 75, 0.15);
}
.email-verify-icon {
    font-size: 56px;
    color: #f2784b;
    margin-bottom: 16px;
}
.email-verify-card h2 {
    color: #1E293B;
    font-size: 22px;
    margin: 0 0 12px;
}
.email-verify-desc {
    color: #475569;
    font-size: 15px;
    line-height: 1.6;
    margin: 0 0 8px;
}
.email-verify-desc strong {
    color: #f2784b;
}
.email-verify-hint {
    color: #94A3B8;
    font-size: 13px;
    line-height: 1.5;
    margin: 0 0 24px;
}
.email-verify-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 16px;
}
.email-verify-actions .btn {
    padding: 12px 20px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}
.email-verify-actions .btn-primary {
    background: linear-gradient(135deg, #f2784b, #f89a77);
    color: white;
}
.email-verify-actions .btn-secondary {
    background: #F1F5F9;
    color: #475569;
}
.email-verify-actions .btn-secondary:hover {
    background: #E2E8F0;
}
.email-verify-msg {
    font-size: 13px;
    min-height: 20px;
    margin: 0 0 12px;
}
.email-verify-msg.success {
    color: #3fa796;
}
.email-verify-msg.error {
    color: #EF4444;
}
.email-verify-footer {
    border-top: 1px solid #E2E8F0;
    padding-top: 16px;
}
.email-verify-footer a {
    color: #94A3B8;
    font-size: 13px;
    text-decoration: underline;
}


/* ============================================
   公告訊息彈窗
   ============================================ */

.announcement-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.announcement-popup {
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    width: 100%;
    max-width: 520px;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: annPopIn 0.3s ease;
}

@keyframes annPopIn {
    from { opacity: 0; transform: scale(0.9) translateY(20px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}

.announcement-popup-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 18px 22px;
    border-bottom: 1px solid #e5e7eb;
    background: linear-gradient(135deg, #f2784b, #f2784b);
    color: #fff;
}

.announcement-popup-header i {
    font-size: 20px;
}

.announcement-popup-header h3 {
    margin: 0;
    font-size: 17px;
    font-weight: 700;
}

.announcement-popup-body {
    padding: 20px 22px;
    overflow-y: auto;
    flex: 1;
}

.announcement-item {
    padding: 14px 0;
    border-bottom: 1px solid #f3f4f6;
}

.announcement-item:last-child {
    border-bottom: none;
}

.announcement-item-title {
    font-size: 15px;
    font-weight: 700;
    color: #1f2937;
    margin-bottom: 6px;
}

.announcement-item-content {
    font-size: 14px;
    color: #4b5563;
    line-height: 1.6;
}

.announcement-item-content p {
    margin: 4px 0;
}

.announcement-item-content strong {
    color: #1f2937;
}

.announcement-item-content a {
    color: #f2784b;
    text-decoration: underline;
}

.announcement-item-date {
    font-size: 11px;
    color: #9ca3af;
    margin-top: 6px;
}

.announcement-popup-footer {
    padding: 14px 22px;
    border-top: 1px solid #e5e7eb;
    text-align: center;
}

.announcement-popup-footer .btn {
    padding: 10px 36px;
    font-size: 15px;
    border-radius: 10px;
}

/* ============================================
   管理員回覆回饋提醒彈窗
   ============================================ */
.feedback-reply-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10001;
    animation: fadeIn 0.3s ease;
}

.feedback-reply-popup {
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    max-width: 440px;
    width: 90%;
    max-height: 80vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    animation: fbReplySlideUp 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes fbReplySlideUp {
    from { opacity: 0; transform: translateY(30px) scale(0.95); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.feedback-reply-popup-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 18px 22px;
    background: linear-gradient(135deg, #f2784b, #f2784b);
    color: #fff;
}

.feedback-reply-popup-header i {
    font-size: 20px;
}

.feedback-reply-popup-header h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
}

.admin-feedback-header {
    background: linear-gradient(135deg, #F59E0B, #D97706);
}

.feedback-reply-popup-body {
    padding: 16px 22px;
    overflow-y: auto;
    max-height: 50vh;
}

.feedback-reply-item {
    padding: 12px 0;
    border-bottom: 1px solid #f1f5f9;
}

.feedback-reply-item:last-child {
    border-bottom: none;
}

.feedback-reply-item-label {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 6px;
}

.feedback-reply-cat {
    font-size: 12px;
    background: #ede9fe;
    color: #e0633a;
    padding: 2px 8px;
    border-radius: 4px;
    font-weight: 500;
}

.feedback-reply-date {
    font-size: 12px;
    color: #94a3b8;
}

.feedback-reply-item-original {
    font-size: 13px;
    color: #64748b;
    margin-bottom: 8px;
    line-height: 1.4;
}

.feedback-reply-item-reply {
    font-size: 14px;
    color: #1e293b;
    background: #fef9c3;
    padding: 10px 12px;
    border-radius: 8px;
    line-height: 1.5;
}

.feedback-reply-item-reply i {
    color: #f59e0b;
    margin-right: 4px;
}

.feedback-reply-popup-footer {
    padding: 14px 22px;
    border-top: 1px solid #e5e7eb;
    display: flex;
    gap: 10px;
    justify-content: center;
}

.feedback-reply-popup-footer .btn {
    padding: 10px 24px;
    font-size: 14px;
    border-radius: 10px;
}

.feedback-reply-popup-footer .btn-secondary {
    background: #f1f5f9;
    color: #64748b;
    border: none;
    cursor: pointer;
}

.feedback-reply-popup-footer .btn-secondary:hover {
    background: #e2e8f0;
}


/* ============================================
   使用里程碑慶祝彈窗
   ============================================ */
.milestone-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    animation: milestoneOverlayIn 0.3s ease;
}

@keyframes milestoneOverlayIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.milestone-card {
    background: #fff;
    border-radius: 20px;
    padding: 40px 32px 32px;
    text-align: center;
    max-width: 340px;
    width: 90%;
    box-shadow: 0 20px 60px rgba(242, 120, 75, 0.3);
    animation: milestonePop 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes milestonePop {
    from { transform: scale(0.5); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

.milestone-emoji {
    font-size: 64px;
    line-height: 1;
    margin-bottom: 12px;
    animation: milestoneEmojiBounce 0.6s ease 0.3s both;
}

@keyframes milestoneEmojiBounce {
    0% { transform: scale(0); }
    50% { transform: scale(1.3); }
    100% { transform: scale(1); }
}

.milestone-title {
    font-size: 22px;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 4px;
}

.milestone-count {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 12px;
}

.milestone-message {
    font-size: 15px;
    color: var(--text-primary);
    line-height: 1.6;
    margin-bottom: 24px;
}

.milestone-btn {
    padding: 10px 40px;
    font-size: 15px;
    border-radius: 12px;
}

/* ============================================
   高顏值科學研究卡片 + 彈窗
   ============================================ */
.science-beauty-card {
    display: flex;
    align-items: center;
    gap: 8px;
    background: linear-gradient(135deg, #e8857b, #f2784b);
    color: #fff;
    padding: 10px 16px;
    border-radius: 10px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 12px;
    transition: transform 0.2s, box-shadow 0.2s;
    box-shadow: 0 2px 8px rgba(232, 133, 123, 0.3);
}
.science-beauty-card:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 14px rgba(232, 133, 123, 0.4);
}
.science-beauty-card i:first-child {
    font-size: 16px;
    flex-shrink: 0;
}
.science-beauty-card span {
    flex: 1;
}
.science-beauty-card i:last-child {
    font-size: 12px;
    opacity: 0.8;
    flex-shrink: 0;
}

.science-beauty-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.55);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    padding: 20px;
    backdrop-filter: blur(4px);
}

.science-beauty-modal {
    background: #fff;
    border-radius: 20px;
    width: 100%;
    max-width: 620px;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    animation: scienceModalSlideIn 0.35s ease-out;
}

@keyframes scienceModalSlideIn {
    from { opacity: 0; transform: translateY(30px) scale(0.95); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.science-beauty-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px 8px;
}
.science-beauty-modal-title {
    display: flex;
    align-items: center;
    gap: 10px;
}
.science-beauty-modal-title i {
    font-size: 24px;
    color: #f2784b;
}
.science-beauty-modal-title h3 {
    margin: 0;
    font-size: 18px;
    color: #1F2937;
}
.science-beauty-close-btn {
    background: #F3F4F6;
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #6B7280;
    font-size: 16px;
    transition: background 0.2s;
}
.science-beauty-close-btn:hover {
    background: #E5E7EB;
    color: #374151;
}

.science-beauty-modal-subtitle {
    padding: 0 24px 12px;
    font-size: 12px;
    color: #9CA3AF;
}

.science-beauty-modal-body {
    padding: 0 24px 16px;
    overflow-y: auto;
    flex: 1;
}

.science-section {
    margin-bottom: 20px;
}
.science-section:last-child {
    margin-bottom: 10px;
}
.science-section-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
    flex-wrap: wrap;
}
.science-section-icon {
    width: 34px;
    height: 34px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    color: #fff;
    flex-shrink: 0;
}
.science-icon-purple { background: linear-gradient(135deg, #f2784b, #e0633a); }
.science-icon-pink { background: linear-gradient(135deg, #e8857b, #d86b61); }
.science-icon-green { background: linear-gradient(135deg, #3fa796, #2e8576); }

.science-section-header h4 {
    margin: 0;
    font-size: 15px;
    color: #1F2937;
    font-weight: 700;
}
.science-badge {
    background: #EDE9FE;
    color: #e0633a;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
}

.science-section-body {
    padding-left: 44px;
}
.science-section-body > p {
    margin: 0 0 10px;
    font-size: 13px;
    color: #4B5563;
    line-height: 1.7;
}

.science-study {
    background: #F9FAFB;
    border-left: 3px solid #D1D5DB;
    padding: 10px 14px;
    border-radius: 0 8px 8px 0;
    margin-bottom: 8px;
}
.science-study-label {
    font-size: 12px;
    font-weight: 700;
    color: #f2784b;
    margin-bottom: 4px;
    display: flex;
    align-items: center;
    gap: 6px;
}
.science-study-label i {
    font-size: 11px;
}
.science-study p {
    margin: 0;
    font-size: 13px;
    color: #4B5563;
    line-height: 1.6;
}

.science-highlight {
    background: linear-gradient(135deg, #FEF3C7, #FDE68A);
    border-radius: 10px;
    padding: 12px 14px;
    display: flex;
    gap: 10px;
    align-items: flex-start;
    margin-top: 8px;
}
.science-highlight i {
    color: #D97706;
    font-size: 16px;
    margin-top: 2px;
    flex-shrink: 0;
}
.science-highlight span {
    font-size: 13px;
    color: #92400E;
    line-height: 1.6;
}

.science-conclusion {
    background: linear-gradient(135deg, #EDE9FE, #ffe6da);
    border-radius: 14px;
    padding: 16px 18px;
    margin-top: 8px;
}
.science-conclusion-title {
    font-size: 14px;
    font-weight: 700;
    color: #4C1D95;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.science-chain {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
    justify-content: center;
}
.science-chain-step {
    display: flex;
    align-items: center;
    gap: 5px;
    background: #fff;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 12px;
    color: #4C1D95;
    font-weight: 600;
    box-shadow: 0 1px 4px rgba(0,0,0,0.08);
}
.chain-icon {
    font-size: 14px;
}
.science-chain-arrow {
    color: #f2784b;
    font-size: 12px;
}

.science-beauty-modal-footer {
    padding: 12px 24px 20px;
    text-align: center;
    border-top: 1px solid #F3F4F6;
}
.science-beauty-modal-footer .btn {
    min-width: 140px;
}

@media (max-width: 768px) {
    .science-beauty-overlay {
        padding: 10px;
        align-items: flex-end;
    }
    .science-beauty-modal {
        max-height: 90vh;
        border-radius: 16px 16px 0 0;
    }
    .science-section-body {
        padding-left: 0;
    }
    .science-chain-step {
        font-size: 11px;
        padding: 5px 8px;
    }
    .science-beauty-card {
        font-size: 12px;
        padding: 8px 12px;
    }
}

/* ============================================
   訂閱前公開說明彈窗
   ============================================ */
.subscription-disclaimer-card {
    background: #fff;
    border-radius: 16px;
    max-width: 580px;
    width: 92%;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25);
    animation: milestonePop 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.subscription-disclaimer-header {
    text-align: center;
    padding: 28px 24px 16px;
    border-bottom: 1px solid #f0f0f0;
    flex-shrink: 0;
}

.subscription-disclaimer-header i {
    font-size: 36px;
    color: #f2784b;
    margin-bottom: 10px;
}

.subscription-disclaimer-header h2 {
    font-size: 1.25rem;
    font-weight: 700;
    color: #1e293b;
    margin: 0 0 6px;
}

.subscription-disclaimer-header p {
    font-size: 0.85rem;
    color: #94a3b8;
    margin: 0;
}

.subscription-disclaimer-body {
    overflow-y: auto;
    padding: 20px 24px;
    flex: 1;
    -webkit-overflow-scrolling: touch;
}

.disclaimer-item {
    display: flex;
    gap: 14px;
    padding: 14px 0;
    border-bottom: 1px solid #f8f8f8;
}

.disclaimer-item:last-child {
    border-bottom: none;
}

.disclaimer-item-icon {
    flex-shrink: 0;
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: #f1f0ff;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #f2784b;
    font-size: 0.95rem;
    margin-top: 2px;
}

.disclaimer-item-content h4 {
    font-size: 0.92rem;
    font-weight: 700;
    color: #334155;
    margin: 0 0 5px;
}

.disclaimer-item-content p {
    font-size: 0.82rem;
    color: #64748b;
    line-height: 1.65;
    margin: 0;
}

.disclaimer-item-content a {
    color: #f2784b;
    text-decoration: underline;
}

.subscription-disclaimer-footer {
    padding: 16px 24px 20px;
    border-top: 1px solid #f0f0f0;
    flex-shrink: 0;
}

.subscription-disclaimer-checkbox {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin-bottom: 16px;
    cursor: pointer;
    font-size: 0.84rem;
    color: #475569;
    line-height: 1.5;
}

.subscription-disclaimer-checkbox input[type="checkbox"] {
    margin-top: 3px;
    width: 18px;
    height: 18px;
    accent-color: #f2784b;
    flex-shrink: 0;
    cursor: pointer;
}

.subscription-disclaimer-checkbox a {
    color: #f2784b;
    text-decoration: underline;
}

.subscription-disclaimer-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
}

.subscription-disclaimer-actions .btn-secondary {
    padding: 10px 24px;
    font-size: 0.9rem;
}

.subscription-disclaimer-actions .btn-primary {
    padding: 10px 28px;
    font-size: 0.9rem;
}

.subscription-disclaimer-actions .btn-primary:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

@media (max-width: 768px) {
    .subscription-disclaimer-card {
        max-width: 100%;
        width: 96%;
        max-height: 90vh;
        border-radius: 14px;
    }

    .subscription-disclaimer-header {
        padding: 20px 16px 12px;
    }

    .subscription-disclaimer-body {
        padding: 16px;
    }

    .disclaimer-item {
        gap: 10px;
        padding: 12px 0;
    }

    .subscription-disclaimer-footer {
        padding: 14px 16px 16px;
    }

    .subscription-disclaimer-actions {
        flex-direction: column;
    }

    .subscription-disclaimer-actions .btn {
        width: 100%;
        text-align: center;
    }
}

/* ============================================
   人格養成解鎖慶祝
   ============================================ */
.persona-unlock-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    animation: milestoneOverlayIn 0.3s ease;
}

.persona-unlock-card {
    background: linear-gradient(135deg, #fff 0%, #f5f3ff 100%);
    border-radius: 20px;
    padding: 40px 32px 32px;
    text-align: center;
    max-width: 340px;
    width: 90%;
    box-shadow: 0 20px 60px rgba(242, 120, 75, 0.35);
    animation: milestonePop 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.persona-unlock-emoji {
    font-size: 72px;
    line-height: 1;
    margin-bottom: 8px;
    animation: personaUnlockSpin 0.8s ease 0.2s both;
}

@keyframes personaUnlockSpin {
    0% { transform: scale(0) rotate(-180deg); opacity: 0; }
    60% { transform: scale(1.2) rotate(10deg); opacity: 1; }
    100% { transform: scale(1) rotate(0deg); opacity: 1; }
}

.persona-unlock-badge {
    display: inline-block;
    background: linear-gradient(135deg, #f2784b, #f2784b);
    color: #fff;
    font-size: 12px;
    font-weight: 700;
    padding: 4px 14px;
    border-radius: 20px;
    letter-spacing: 1px;
    margin-bottom: 8px;
}

.persona-unlock-name {
    font-size: 24px;
    font-weight: 800;
    color: #f2784b;
    margin-bottom: 6px;
}

.persona-unlock-message {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 12px;
}

.persona-unlock-hint {
    font-size: 12px;
    color: #a78bfa;
    margin-bottom: 20px;
    font-style: italic;
}

/* 人格卡片解鎖徽章 */
.persona-unlocked-badge {
    position: absolute;
    top: 6px;
    right: 6px;
    background: linear-gradient(135deg, #f2784b, #f2784b);
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 10px;
    z-index: 2;
    pointer-events: none;
}

.persona-unlocked-badge.trial-expired {
    background: linear-gradient(135deg, #9ca3af, #6b7280);
}

/* 書籤按鈕（AI 回覆下方） */
.bookmark-btn {
    background: none;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 4px 10px;
    font-size: 12px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s;
}

.bookmark-btn:hover {
    border-color: #F59E0B;
    color: #F59E0B;
}

.bookmark-btn.bookmarked {
    background: #FEF3C7;
    border-color: #F59E0B;
    color: #D97706;
}

/* 收藏頁卡片 */
.bookmarks-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.bookmark-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 16px;
    transition: box-shadow 0.2s;
}

.bookmark-card:hover {
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
}

.bookmark-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.bookmark-date {
    font-size: 12px;
    color: var(--text-secondary);
}

.bookmark-delete-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 12px;
    transition: all 0.2s;
}

.bookmark-delete-btn:hover {
    background: #FEE2E2;
    color: #DC2626;
}

.bookmark-question {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 8px;
    line-height: 1.5;
}

.bookmark-answer {
    font-size: 0.9rem;
    color: var(--text-primary);
    line-height: 1.6;
    white-space: pre-wrap;
    word-break: break-word;
}

/* 連續登入獎勵彈窗 */
.streak-reward-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    animation: milestoneOverlayIn 0.3s ease;
}

.streak-reward-card {
    background: linear-gradient(135deg, #fff 0%, #fff7ed 100%);
    border-radius: 20px;
    padding: 40px 32px 32px;
    text-align: center;
    max-width: 340px;
    width: 90%;
    box-shadow: 0 20px 60px rgba(249, 115, 22, 0.35);
    animation: milestonePop 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.streak-reward-emoji {
    font-size: 72px;
    line-height: 1;
    margin-bottom: 8px;
    animation: milestoneEmojiBounce 0.6s ease 0.2s both;
}

.streak-reward-badge {
    display: inline-block;
    background: linear-gradient(135deg, #F97316, #F59E0B);
    color: #fff;
    font-size: 12px;
    font-weight: 700;
    padding: 4px 14px;
    border-radius: 20px;
    letter-spacing: 1px;
    margin-bottom: 8px;
}

.streak-reward-title {
    font-size: 24px;
    font-weight: 800;
    color: #F97316;
    margin-bottom: 6px;
}

.streak-reward-days {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.streak-reward-message {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 20px;
}

/* ============================================
   每日一句推送（全螢幕居中覆蓋層 + 圓形頭像影片）
   ============================================ */
.daily-quote-overlay {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: none;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.45);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    opacity: 0;
    transition: opacity 0.5s ease;
}

.daily-quote-overlay.show {
    opacity: 1;
}

.daily-quote-center {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    transform: scale(0.8);
    opacity: 0;
    animation: dailyQuoteEnter 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) 0.15s forwards;
}

/* 圓形頭像影片容器（5 倍大 = 150px） */
.daily-quote-avatar {
    position: relative;
    width: 150px;
    height: 150px;
    border-radius: 50%;
    overflow: hidden;
    border: 3px solid rgba(255, 255, 255, 0.6);
    box-shadow:
        0 0 30px rgba(242, 120, 75, 0.4),
        0 0 60px rgba(242, 120, 75, 0.15);
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    animation: dailyQuoteGlow 3s ease-in-out infinite alternate;
}

.daily-quote-video,
.daily-quote-image {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

.daily-quote-video {
    display: none;
}

/* 每日一句文字卡片 */
.daily-quote-card {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-light));
    color: #fff;
    padding: 18px 32px;
    border-radius: 20px;
    box-shadow: 0 8px 40px rgba(242, 120, 75, 0.4);
    max-width: 420px;
    width: 90vw;
    text-align: center;
    font-size: 16px;
    line-height: 1.6;
}

.daily-quote-card .quote-text {
    font-weight: 500;
}

.daily-quote-card .quote-label {
    font-size: 12px;
    opacity: 0.8;
    margin-bottom: 6px;
}

/* 關閉提示 */
.daily-quote-dismiss {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.55);
    letter-spacing: 1px;
    margin-top: 4px;
}

/* 進入動畫 */
@keyframes dailyQuoteEnter {
    to {
        transform: scale(1);
        opacity: 1;
    }
}

/* 頭像輝光呼吸 */
@keyframes dailyQuoteGlow {
    from {
        box-shadow:
            0 0 30px rgba(242, 120, 75, 0.4),
            0 0 60px rgba(242, 120, 75, 0.15);
    }
    to {
        box-shadow:
            0 0 40px rgba(232, 133, 123, 0.4),
            0 0 80px rgba(232, 133, 123, 0.15);
    }
}

/* 退出動畫 */
.daily-quote-overlay.hiding .daily-quote-center {
    animation: dailyQuoteExit 0.4s ease-in forwards;
}

@keyframes dailyQuoteExit {
    to {
        transform: scale(0.85);
        opacity: 0;
    }
}

/* 手機版微調 */
@media (max-width: 768px) {
    .daily-quote-avatar {
        width: 120px;
        height: 120px;
    }

    .daily-quote-card {
        padding: 14px 24px;
        font-size: 15px;
    }
}

/* ============================================
   Iris 迎賓詞推送（全螢幕居中覆蓋層 + 粉色溫馨主題）
   ============================================ */
.iris-welcome-overlay {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: none;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.55);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    opacity: 0;
    transition: opacity 0.5s ease;
}

.iris-welcome-overlay.show {
    opacity: 1;
}

.iris-welcome-center {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    transform: scale(0.8);
    opacity: 0;
    animation: irisWelcomeEnter 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) 0.15s forwards;
}

.iris-welcome-avatar {
    position: relative;
    width: 150px;
    height: 150px;
    border-radius: 50%;
    overflow: hidden;
    border: 3px solid rgba(255, 255, 255, 0.7);
    box-shadow:
        0 0 30px rgba(232, 133, 123, 0.4),
        0 0 60px rgba(232, 133, 123, 0.15);
    background: linear-gradient(135deg, #e8857b, #fb7185);
    animation: irisWelcomeGlow 3s ease-in-out infinite alternate;
}

.iris-welcome-video,
.iris-welcome-image {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

.iris-welcome-video {
    display: none;
}

.iris-welcome-card {
    background: linear-gradient(135deg, #e8857b, #f0a59c);
    color: #fff;
    padding: 18px 32px;
    border-radius: 20px;
    box-shadow: 0 8px 40px rgba(232, 133, 123, 0.4);
    max-width: 420px;
    width: 90vw;
    text-align: center;
    font-size: 16px;
    line-height: 1.6;
}

.iris-welcome-card .iris-welcome-text {
    font-weight: 500;
}

.iris-welcome-card .iris-welcome-label {
    font-size: 12px;
    opacity: 0.85;
    margin-bottom: 6px;
}

.iris-welcome-dismiss {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.7);
    letter-spacing: 1px;
    margin-top: 4px;
}

@keyframes irisWelcomeEnter {
    to {
        transform: scale(1);
        opacity: 1;
    }
}

@keyframes irisWelcomeGlow {
    from {
        box-shadow:
            0 0 30px rgba(232, 133, 123, 0.4),
            0 0 60px rgba(232, 133, 123, 0.15);
    }
    to {
        box-shadow:
            0 0 40px rgba(251, 113, 133, 0.45),
            0 0 80px rgba(251, 113, 133, 0.18);
    }
}

.iris-welcome-overlay.hiding .iris-welcome-center {
    animation: irisWelcomeExit 0.4s ease-in forwards;
}

@keyframes irisWelcomeExit {
    to {
        transform: scale(0.85);
        opacity: 0;
    }
}

@media (max-width: 768px) {
    .iris-welcome-avatar {
        width: 120px;
        height: 120px;
    }

    .iris-welcome-card {
        padding: 14px 24px;
        font-size: 15px;
    }
}

/* ============================================
   AI 主動關懷訊息
   ============================================ */
.care-message {
    background: linear-gradient(135deg, #fff1e8, #fff4ee);
    border: 1px solid #ffe6da;
    border-radius: 14px;
    padding: 14px 18px;
    margin: 8px 12px;
    font-size: 14px;
    line-height: 1.6;
    color: var(--text-primary);
    animation: careSlideIn 0.5s ease;
}

@keyframes careSlideIn {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

.care-message .care-label {
    /* 用 em 而非 px，這樣 chat font scale 改動父元素 font-size 時，
       label 會自動跟著縮放（11/14 ≈ 0.786em） */
    font-size: 0.786em;
    color: var(--primary-color);
    font-weight: 600;
    margin-bottom: 4px;
}

.care-message .care-text {
    color: var(--text-primary);
}

/* ============================================
   Prompt 範本庫面板
   ============================================ */

/* 範本切換按鈕（chat-footer 左側） */
.template-toggle-btn {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    background: var(--bg-secondary);
    color: var(--primary-color);
    font-size: 16px;
    cursor: pointer;
    flex-shrink: 0;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.template-toggle-btn:hover {
    background: var(--primary-color);
    color: #fff;
    border-color: var(--primary-color);
}

/* 範本面板（chat-window 內，輸入框上方） */
.template-panel {
    display: flex;
    flex-direction: column;
    border-top: 1px solid var(--border-color);
    background: var(--bg-primary);
    max-height: 320px;
    animation: templateSlideUp 0.25s ease;
}

@keyframes templateSlideUp {
    from { max-height: 0; opacity: 0; }
    to { max-height: 320px; opacity: 1; }
}

.template-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    border-bottom: 1px solid var(--border-color);
    flex-shrink: 0;
}

.template-panel-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}

.template-panel-title i {
    color: var(--primary-color);
    margin-right: 6px;
}

.template-panel-close {
    width: 28px;
    height: 28px;
    border: none;
    background: none;
    color: var(--text-secondary);
    cursor: pointer;
    border-radius: 6px;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.template-panel-close:hover {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

/* Tabs 橫向捲動 */
.template-panel-tabs {
    display: flex;
    gap: 4px;
    padding: 8px 12px;
    overflow-x: auto;
    flex-shrink: 0;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}

.template-panel-tabs::-webkit-scrollbar {
    display: none;
}

/* ──────────────────────────────────────────────
   分類選擇器：chip + grid popover（取代橫向長條 tab bar）
   設計：預設只顯示「目前選中分類」chip，點下去展開全部分類成 grid，
         點任一分類選中後 popover 自動收起。
   ────────────────────────────────────────────── */
.template-category-picker {
    position: relative;
    padding: 8px 12px 4px;
    flex-shrink: 0;
}

.template-category-chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 14px;
    border-radius: 20px;
    border: 1.5px solid var(--primary-color);
    background: var(--bg-primary);
    color: var(--primary-color);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.18s ease;
}

.template-category-chip:hover {
    background: var(--primary-color);
    color: white;
}

.template-category-chip-caret {
    font-size: 10px;
    transition: transform 0.2s ease;
}

.template-category-chip.open .template-category-chip-caret {
    transform: rotate(180deg);
}

.template-category-popover {
    position: absolute;
    /* 向上展開：從 chip 上方往上長，避免壓到下方範本列表 */
    bottom: 100%;
    left: 12px;
    right: 12px;
    margin-bottom: 6px;
    padding: 10px;
    /* 用 #FFFFFF 寫死避免 --bg-primary 在 :root 未定義導致背景透明 */
    background: #FFFFFF;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    box-shadow: 0 -8px 24px rgba(0, 0, 0, 0.15);
    z-index: 20;
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 6px;
    transform-origin: bottom center;
    animation: templatePopoverIn 0.16s ease;
    /* 限制最高高度，超過時內部 scroll，避免分類太多時蓋滿整個對話框 */
    max-height: 280px;
    overflow-y: auto;
}

@keyframes templatePopoverIn {
    from { opacity: 0; transform: scale(0.96) translateY(4px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}

@media (min-width: 480px) {
    .template-category-popover {
        grid-template-columns: repeat(3, 1fr);
    }
}

.template-category-popover-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    border-radius: 8px;
    border: 1px solid transparent;
    background: var(--bg-secondary, #f8fafc);
    color: var(--text-primary);
    font-size: 12px;
    cursor: pointer;
    text-align: left;
    transition: all 0.15s ease;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.template-category-popover-item:hover {
    background: var(--primary-color);
    color: white;
    transform: translateX(2px);
}

.template-category-popover-item.active {
    border-color: var(--primary-color);
    background: rgba(242, 120, 75, 0.08);
    color: var(--primary-color);
    font-weight: 600;
}

.template-category-popover-item.locked {
    opacity: 0.55;
}

.template-category-popover-item .lock-icon {
    margin-left: auto;
    font-size: 10px;
}

.template-category-popover-section {
    grid-column: 1 / -1;
    font-size: 10px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 4px 4px 2px;
    margin-top: 4px;
}
.template-category-popover-section:first-child {
    margin-top: 0;
}

.template-tab {
    padding: 5px 12px;
    border-radius: 20px;
    border: 1px solid var(--border-color);
    background: var(--bg-primary);
    color: var(--text-secondary);
    font-size: 12px;
    cursor: pointer;
    white-space: nowrap;
    flex-shrink: 0;
    transition: all 0.2s ease;
}

.template-tab i:first-child {
    margin-right: 4px;
    font-size: 11px;
}

.template-tab:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.template-tab.active {
    background: var(--primary-color);
    color: #fff;
    border-color: var(--primary-color);
}

.template-tab.locked {
    opacity: 0.6;
}

.template-tab-lock {
    font-size: 9px;
    margin-left: 3px;
}

/* 範本內容區（可捲動） */
.template-panel-body {
    flex: 1;
    overflow-y: auto;
    padding: 8px 12px;
    min-height: 0;
}

.template-loading {
    text-align: center;
    padding: 24px;
    color: var(--text-secondary);
    font-size: 13px;
}

.template-loading i {
    margin-right: 6px;
}

/* 範本列表 */
.template-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.template-list-locked {
    opacity: 0.5;
    pointer-events: none;
}

/* 單個範本項目 */
.template-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.15s ease;
}

.template-item:hover {
    background: var(--bg-secondary);
}

.template-item:active {
    transform: scale(0.98);
}

.template-item-icon {
    color: var(--primary-color);
    font-size: 14px;
    width: 18px;
    text-align: center;
    flex-shrink: 0;
}

.template-item-text {
    flex: 1;
    font-size: 13px;
    color: var(--text-primary);
    line-height: 1.4;
}

.template-item-arrow {
    color: var(--text-secondary);
    font-size: 11px;
    flex-shrink: 0;
    opacity: 0;
    transition: opacity 0.15s ease;
}

.template-item:hover .template-item-arrow {
    opacity: 1;
}

/* 鎖定的範本 */
.template-item-locked {
    cursor: default;
    opacity: 0.55;
}

.template-item-locked:hover {
    background: transparent;
}

.template-item-locked:active {
    transform: none;
}

.template-item-badge {
    font-size: 10px;
    padding: 2px 8px;
    border-radius: 10px;
    background: var(--bg-secondary);
    color: var(--text-secondary);
    flex-shrink: 0;
    white-space: nowrap;
}

/* 分類鎖定提示 */
.template-locked-notice {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 14px;
    margin-bottom: 8px;
    border-radius: 10px;
    background: linear-gradient(135deg, #FEF3C7, #FDE68A);
    color: #92400E;
    font-size: 13px;
    line-height: 1.4;
}

.template-locked-notice i {
    font-size: 14px;
    flex-shrink: 0;
}

.template-upgrade-btn {
    margin-left: auto;
    padding: 4px 12px;
    border-radius: 8px;
    border: none;
    background: #92400E;
    color: #FEF3C7;
    font-size: 12px;
    cursor: pointer;
    white-space: nowrap;
    flex-shrink: 0;
}

.template-upgrade-btn:hover {
    background: #78350F;
}

/* 手機版調整 */
@media (max-width: 768px) {
    .template-panel {
        max-height: 260px;
    }

    .template-toggle-btn {
        width: 36px;
        height: 36px;
        font-size: 14px;
    }
}

/* ============================================
   設定頁 — 通知設定 toggle row
   ============================================ */
.settings-toggle-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 14px 0;
}

.settings-toggle-info {
    flex: 1;
}

.settings-toggle-label {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 2px;
}

.settings-toggle-desc {
    font-size: 12px;
    color: var(--text-secondary);
    line-height: 1.4;
}

/* === 聊天中記帳通知 === */
.bk-chat-notification {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 8px 20px;
    padding: 10px 16px;
    background: linear-gradient(135deg, #f0fdf4, #ecfdf5);
    border: 1px solid #bbf7d0;
    border-radius: 12px;
    font-size: 0.82rem;
    transition: opacity 0.5s ease;
    animation: bkNotifSlideIn 0.3s ease;
}

.bk-chat-notif-icon {
    font-size: 1.2rem;
    flex-shrink: 0;
}

.bk-chat-notif-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.bk-chat-notif-title {
    font-weight: 600;
    color: #16a34a;
}

.bk-chat-notif-detail {
    color: #4b5563;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

@keyframes bkNotifSlideIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* === 記帳簿頁面 === */
#bookkeepingPage .card {
    padding: 20px;
    margin-bottom: 16px;
}

#bookkeepingPage .card h3 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}

#bookkeepingPage .card h3 i {
    color: var(--primary-color);
}

/* 快速記帳 */
.bk-hint {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 12px;
}

.bk-input-row {
    display: flex;
    gap: 10px;
}

.bk-input {
    flex: 1;
    padding: 10px 14px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 14px;
    color: var(--text-primary);
    background: var(--bg-color);
    outline: none;
    transition: border-color 0.2s;
}

.bk-input:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(242, 120, 75, 0.1);
}

.bk-submit-btn {
    white-space: nowrap;
    padding: 10px 18px;
    font-size: 14px;
}

/* AI 提取結果 */
.bk-extract-result {
    margin-top: 14px;
    padding: 14px;
    background: var(--bg-color);
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.bk-confirm-header {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 10px;
}

.bk-confirm-entries {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 14px;
}

.bk-confirm-entry {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: white;
    border-radius: 6px;
    font-size: 14px;
}

.bk-confirm-actions {
    display: flex;
    gap: 10px;
}

.bk-confirm-actions .btn {
    padding: 8px 16px;
    font-size: 13px;
}

.bk-error {
    color: #EF4444;
    font-size: 13px;
}

/* 摘要卡片 */
.bk-summary-cards {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin-bottom: 16px;
}

.bk-summary-card {
    background: white;
    border-radius: 12px;
    padding: 16px;
    text-align: center;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
}

.bk-summary-label {
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 6px;
    font-weight: 500;
}

.bk-summary-value {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--text-primary);
}

.bk-expense-card {
    border-top: 3px solid #EF4444;
}

.bk-income-card {
    border-top: 3px solid #3fa796;
}

.bk-net-card {
    border-top: 3px solid var(--primary-color);
}

.bk-positive {
    color: #3fa796 !important;
}

.bk-negative {
    color: #EF4444 !important;
}

/* 分類統計 */
.bk-category-bars {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.bk-cat-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.bk-cat-label {
    min-width: 80px;
    font-size: 13px;
    color: var(--text-primary);
}

.bk-cat-bar-bg {
    flex: 1;
    height: 8px;
    background: var(--bg-color);
    border-radius: 4px;
    overflow: hidden;
}

.bk-cat-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-color), var(--primary-light));
    border-radius: 4px;
    transition: width 0.4s ease;
}

.bk-cat-amount {
    min-width: 70px;
    text-align: right;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
}

/* 預算 */
.bk-budget-row {
    display: flex;
    gap: 10px;
    margin-bottom: 12px;
}

.bk-budget-input {
    max-width: 200px;
}

.bk-budget-status {
    font-size: 14px;
}

.bk-budget-progress {
    margin-top: 8px;
}

.bk-budget-bar-bg {
    height: 10px;
    background: var(--bg-color);
    border-radius: 5px;
    overflow: hidden;
}

.bk-budget-bar-fill {
    height: 100%;
    border-radius: 5px;
    transition: width 0.4s ease;
}

/* 交易列表 header（標題 + 匯出按鈕） */
.bk-transactions-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 4px;
}
.bk-transactions-header h3 { margin-bottom: 0; }
.bk-export-btn {
    font-size: 13px;
    padding: 6px 14px;
    gap: 5px;
    display: inline-flex;
    align-items: center;
    white-space: nowrap;
}

/* 交易列表 */
.bk-tx-list {
    display: flex;
    flex-direction: column;
}

/* 記帳收摺手風琴 — 月層 */
.bk-accordion-month {
    border-bottom: 1px solid var(--border-color);
}
.bk-accordion-month:last-child { border-bottom: none; }

.bk-accordion-month-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 4px;
    cursor: pointer;
    user-select: none;
    gap: 8px;
    transition: background 0.15s;
    border-radius: 8px;
}
.bk-accordion-month-header:hover { background: rgba(242, 120, 75,0.05); }
.bk-accordion-month-header:active { background: rgba(242, 120, 75,0.10); }

.bk-accordion-month-left {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}
.bk-accordion-month-title {
    font-size: 15px;
    font-weight: 700;
    color: var(--text-primary);
    white-space: nowrap;
}
.bk-accordion-month-right {
    flex-shrink: 0;
}
.bk-accordion-month-summary {
    display: flex;
    gap: 10px;
    font-size: 12px;
    font-weight: 600;
}

.bk-accordion-month-body {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
}
.bk-accordion-month.open > .bk-accordion-month-body {
    max-height: 9999px;
}
.bk-accordion-month.open > .bk-accordion-month-header .bk-accordion-arrow {
    transform: rotate(90deg);
}

/* 記帳收摺手風琴 — 日層 */
.bk-accordion-day {
    margin-left: 8px;
    border-left: 2px solid rgba(242, 120, 75,0.12);
    padding-left: 10px;
}
.bk-accordion-day-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 4px;
    cursor: pointer;
    user-select: none;
    gap: 8px;
    transition: background 0.15s;
    border-radius: 6px;
}
.bk-accordion-day-header:hover { background: rgba(0,0,0,0.03); }

.bk-accordion-day-left {
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
}
.bk-accordion-day-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    white-space: nowrap;
}
.bk-accordion-day-right {
    display: flex;
    gap: 8px;
    font-size: 12px;
    font-weight: 600;
    flex-shrink: 0;
}

.bk-accordion-day-body {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.25s ease;
}
.bk-accordion-day.open > .bk-accordion-day-body {
    max-height: 9999px;
}
.bk-accordion-day.open > .bk-accordion-day-header .bk-accordion-arrow {
    transform: rotate(90deg);
}

/* 共用箭頭 + 徽章 */
.bk-accordion-arrow {
    font-size: 10px;
    color: var(--text-secondary);
    transition: transform 0.25s ease;
    width: 14px;
    text-align: center;
    flex-shrink: 0;
}
.bk-accordion-badge {
    font-size: 11px;
    font-weight: 500;
    color: #fff;
    background: var(--primary-color, #f2784b);
    padding: 1px 7px;
    border-radius: 10px;
    white-space: nowrap;
}

.bk-tx-date-header {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    padding: 10px 0 6px;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 4px;
}

.bk-tx-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 0;
    border-bottom: 1px solid rgba(0, 0, 0, 0.04);
}

.bk-tx-item:last-child {
    border-bottom: none;
}

.bk-tx-icon {
    font-size: 1.3rem;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-color);
    border-radius: 8px;
    flex-shrink: 0;
}

.bk-tx-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.bk-tx-desc {
    font-size: 14px;
    color: var(--text-primary);
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.bk-tx-cat {
    font-size: 12px;
    color: var(--text-secondary);
}

.bk-tx-amount {
    font-size: 14px;
    font-weight: 600;
    white-space: nowrap;
    flex-shrink: 0;
}

.bk-tx-delete {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 6px;
    border-radius: 6px;
    font-size: 13px;
    opacity: 0;
    transition: all 0.2s;
    flex-shrink: 0;
}

.bk-tx-item:hover .bk-tx-delete {
    opacity: 1;
}

.bk-tx-delete:hover {
    color: #EF4444;
    background: rgba(239, 68, 68, 0.08);
}

/* 空狀態 & 載入中 */
.bk-empty {
    text-align: center;
    color: var(--text-secondary);
    font-size: 14px;
    padding: 30px 0;
}

.bk-loading {
    text-align: center;
    color: var(--text-secondary);
    padding: 20px 0;
}

/* 消費洞察卡片 */
.bk-insight-card {
    border-left-color: #F59E0B !important;
}

.bk-insight-stats {
    margin-top: 8px;
    /* 用 em 跟著父元素 font-size scale（12/14 ≈ 0.857em） */
    font-size: 0.857em;
    color: var(--text-secondary);
    font-weight: 500;
}

/* 手機版響應式 */
@media (max-width: 768px) {
    .bk-summary-cards {
        grid-template-columns: 1fr;
        gap: 8px;
    }

    .bk-summary-card {
        display: flex;
        justify-content: space-between;
        align-items: center;
        text-align: left;
        padding: 12px 16px;
    }

    .bk-summary-label {
        margin-bottom: 0;
    }

    .bk-summary-value {
        font-size: 1.2rem;
    }

    .bk-input-row {
        flex-direction: column;
    }

    .bk-submit-btn {
        width: 100%;
    }

    .bk-budget-row {
        flex-direction: column;
    }

    .bk-budget-input {
        max-width: 100%;
    }

    .bk-tx-delete {
        opacity: 1;
    }

    .bk-cat-label {
        min-width: 70px;
        font-size: 12px;
    }
}

/* ========================================
   技巧教學頁面
   ======================================== */

.tutorial-progress-bar {
    background: white;
    border-radius: 14px;
    padding: 18px 22px;
    margin-bottom: 28px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    border: 1px solid #E5E7EB;
}

.tutorial-progress-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.tutorial-progress-label {
    font-weight: 600;
    font-size: 0.95rem;
    color: #374151;
}

.tutorial-progress-count {
    font-size: 0.88rem;
    color: #f2784b;
    font-weight: 600;
}

.tutorial-progress-track {
    width: 100%;
    height: 10px;
    background: #F3F4F6;
    border-radius: 6px;
    overflow: hidden;
}

.tutorial-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #f2784b, #f89a77, #A78BFA);
    border-radius: 6px;
    transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    min-width: 0;
}

.tutorial-category {
    margin-bottom: 28px;
}

.tutorial-category-title {
    font-size: 1.05rem;
    font-weight: 700;
    color: #374151;
    margin-bottom: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.tutorial-category-title i {
    color: #f2784b;
    font-size: 1rem;
}

.tutorial-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 14px;
}

.tutorial-card {
    background: white;
    border: 1.5px solid #E5E7EB;
    border-radius: 14px;
    padding: 20px;
    cursor: pointer;
    transition: all 0.25s ease;
    position: relative;
    overflow: hidden;
}

.tutorial-card:hover {
    border-color: #f3b89a;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(242, 120, 75,0.12);
}

.tutorial-card.completed {
    border-color: #86EFAC;
    background: #F0FDF4;
}

.tutorial-card.completed:hover {
    border-color: #4ADE80;
}

.tutorial-card-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 10px;
}

.tutorial-card-icon {
    width: 42px;
    height: 42px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    color: white;
    flex-shrink: 0;
}

.tutorial-card-title {
    font-size: 0.95rem;
    font-weight: 600;
    color: #1F2937;
    line-height: 1.3;
}

.tutorial-card-desc {
    font-size: 0.83rem;
    color: #6B7280;
    line-height: 1.5;
    margin-bottom: 14px;
}

.tutorial-card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.tutorial-card-time {
    font-size: 0.78rem;
    color: #9CA3AF;
    display: flex;
    align-items: center;
    gap: 4px;
}

.tutorial-card-status {
    font-size: 0.78rem;
    font-weight: 600;
    padding: 3px 10px;
    border-radius: 20px;
}

.tutorial-card-status.done {
    background: #DCFCE7;
    color: #16A34A;
}

.tutorial-card-status.todo {
    background: #fff1e8;
    color: #f2784b;
}

.tutorial-card-new {
    position: absolute;
    top: 10px;
    right: 10px;
    background: linear-gradient(135deg, #F59E0B, #FBBF24);
    color: white;
    font-size: 0.65rem;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    animation: tutorialNewPulse 2s ease-in-out infinite;
}

@keyframes tutorialNewPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

/* ========================================
   Spotlight 引導覆蓋層
   ======================================== */

.spotlight-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 99999;
    pointer-events: none;
}

.spotlight-overlay::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.55);
    pointer-events: auto;
}

.spotlight-overlay.has-highlight::before {
    background: transparent;
}

.spotlight-highlight {
    position: absolute;
    border-radius: 8px;
    box-shadow: 0 0 0 4000px rgba(0,0,0,0.55), 0 0 0 3px #f2784b, 0 0 20px rgba(242, 120, 75,0.4);
    z-index: 100000;
    pointer-events: none;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    animation: spotlightPulse 2s ease-in-out infinite;
}

@keyframes spotlightPulse {
    0%, 100% { box-shadow: 0 0 0 4000px rgba(0,0,0,0.55), 0 0 0 3px #f2784b, 0 0 20px rgba(242, 120, 75,0.4); }
    50% { box-shadow: 0 0 0 4000px rgba(0,0,0,0.55), 0 0 0 3px #f89a77, 0 0 30px rgba(242, 120, 75,0.6); }
}

.spotlight-tooltip {
    position: absolute;
    background: linear-gradient(135deg, #fff1e8, #fff4ee);
    border: 1px solid #ffe6da;
    border-radius: 16px;
    padding: 20px 22px;
    max-width: 340px;
    width: 90vw;
    box-shadow: 0 12px 40px rgba(0,0,0,0.25);
    z-index: 100001;
    pointer-events: auto;
    animation: spotlightTooltipIn 0.3s ease;
}

@keyframes spotlightTooltipIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

.spotlight-tooltip-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.spotlight-step-badge {
    background: #fff1e8;
    color: #f2784b;
    font-size: 0.75rem;
    font-weight: 700;
    padding: 3px 10px;
    border-radius: 12px;
}

.spotlight-close-btn {
    background: none;
    border: none;
    color: #9CA3AF;
    font-size: 1rem;
    cursor: pointer;
    padding: 4px;
    border-radius: 6px;
    transition: all 0.2s;
}

.spotlight-close-btn:hover {
    color: #374151;
    background: rgba(255,255,255,0.5);
}

.spotlight-title {
    font-size: 1rem;
    font-weight: 700;
    color: #1F2937;
    margin-bottom: 6px;
}

.spotlight-desc {
    font-size: 0.88rem;
    color: #6B7280;
    line-height: 1.6;
    margin-bottom: 16px;
}

.spotlight-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.spotlight-btn-skip {
    background: none;
    border: none;
    color: #9CA3AF;
    font-size: 0.88rem;
    cursor: pointer;
    padding: 6px 12px;
    border-radius: 8px;
    transition: all 0.2s;
}

.spotlight-btn-skip:hover {
    color: #f2784b;
    background: #F5F3FF;
}

.spotlight-btn-next {
    background: linear-gradient(135deg, #f2784b, #f89a77);
    color: white;
    border: none;
    padding: 8px 20px;
    border-radius: 10px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s;
}

.spotlight-btn-next:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(242, 120, 75,0.3);
}

/* Mobile responsive for tutorials */
@media (max-width: 768px) {
    .tutorial-grid {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .tutorial-card {
        padding: 16px;
    }

    .spotlight-tooltip {
        max-width: 300px;
        padding: 16px 18px;
    }
}

/* ============================================
   功能解鎖一覽頁面
   ============================================ */

.unlock-current-plan {
    margin-bottom: 24px;
}

.unlock-plan-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: linear-gradient(135deg, #f2784b, #f2784b);
    color: #fff;
    padding: 12px 24px;
    border-radius: 12px;
    font-size: 15px;
    box-shadow: 0 4px 12px rgba(242, 120, 75, 0.3);
}

.unlock-plan-badge strong {
    font-size: 17px;
}

.unlock-section {
    background: #fff;
    border-radius: 16px;
    padding: 24px;
    margin-bottom: 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    border: 1px solid #f0f0f0;
}

.unlock-section-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 16px;
}

.unlock-section-header i {
    font-size: 20px;
    color: #f2784b;
    width: 28px;
    text-align: center;
}

.unlock-section-header h2 {
    font-size: 18px;
    font-weight: 700;
    margin: 0;
    color: #1e293b;
}

.unlock-section-desc {
    font-size: 13px;
    color: #64748b;
    margin: -8px 0 16px 0;
    padding-left: 38px;
}

.unlock-table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.unlock-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.unlock-table th {
    background: #f8fafc;
    color: #475569;
    font-weight: 600;
    padding: 10px 14px;
    text-align: left;
    border-bottom: 2px solid #e2e8f0;
    white-space: nowrap;
}

.unlock-table td {
    padding: 10px 14px;
    border-bottom: 1px solid #f1f5f9;
    color: #334155;
}

.unlock-table tbody tr:hover {
    background: #f8fafc;
}

.unlock-row-mine {
    background: #fff1e8 !important;
}

.unlock-row-mine td {
    color: #c9542e;
    font-weight: 600;
}

.unlock-row-mine td:first-child::after {
    content: ' ← 你';
    font-size: 11px;
    color: #f2784b;
    font-weight: 500;
}

.unlock-row-done {
    background: #F0FDF4 !important;
}

.unlock-row-done td {
    color: #166534;
}

.unlock-row-ready {
    background: #FFFBEB !important;
}

.unlock-row-ready td {
    color: #92400E;
}

.unlock-yes {
    color: #3fa796;
    font-weight: 700;
    font-size: 16px;
}

.unlock-no {
    color: #CBD5E1;
    font-size: 16px;
}

.unlock-all {
    color: #3fa796;
    font-weight: 600;
}

.unlock-badge-done {
    display: inline-block;
    background: #DCFCE7;
    color: #166534;
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 10px;
    margin-left: 6px;
    font-weight: 600;
}

.unlock-badge-ready {
    display: inline-block;
    background: #FEF3C7;
    color: #92400E;
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 10px;
    margin-left: 6px;
    font-weight: 600;
    animation: unlockPulse 2s infinite;
}

.unlock-claim-btn {
    display: inline-block;
    background: linear-gradient(135deg, #F59E0B, #D97706);
    color: #fff;
    font-size: 11px;
    padding: 3px 12px;
    border-radius: 10px;
    margin-left: 6px;
    font-weight: 600;
    border: none;
    cursor: pointer;
    animation: unlockPulse 2s infinite;
    transition: all 0.2s;
}
.unlock-claim-btn:hover {
    background: linear-gradient(135deg, #D97706, #B45309);
    transform: scale(1.05);
}
.unlock-claim-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    animation: none;
    transform: none;
}

@keyframes unlockPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

.unlock-subsection {
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px dashed #e2e8f0;
}

.unlock-subsection h3 {
    font-size: 15px;
    font-weight: 600;
    color: #334155;
    margin: 0 0 12px 0;
    display: flex;
    align-items: center;
}

.unlock-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
}

.unlock-chip {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    background: #F8FAFC;
    border: 1px solid #E2E8F0;
    border-radius: 12px;
    padding: 12px 16px;
    font-size: 14px;
    font-weight: 600;
    color: #475569;
    min-width: 100px;
    text-align: center;
    position: relative;
    transition: all 0.2s;
}

.unlock-chip:hover {
    border-color: #CBD5E1;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.unlock-chip-done {
    background: #F0FDF4;
    border-color: #86EFAC;
    color: #166534;
}

.unlock-chip-sub {
    font-size: 11px;
    font-weight: 400;
    color: #94A3B8;
}

.unlock-chip-done .unlock-chip-sub {
    color: #4ADE80;
}

.unlock-chip-check {
    position: absolute;
    top: -4px;
    right: -4px;
    background: #3fa796;
    color: #fff;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    box-shadow: 0 2px 4px rgba(63, 167, 150, 0.3);
}

/* 手機版適配 */
@media (max-width: 768px) {
    .unlock-section {
        padding: 16px;
        border-radius: 12px;
    }

    .unlock-section-header h2 {
        font-size: 16px;
    }

    .unlock-table {
        font-size: 12px;
    }

    .unlock-table th,
    .unlock-table td {
        padding: 8px 10px;
    }

    .unlock-section-desc {
        padding-left: 0;
    }

    .unlock-chip {
        min-width: 80px;
        padding: 10px 12px;
        font-size: 13px;
    }

    .unlock-plan-badge {
        font-size: 13px;
        padding: 10px 18px;
    }

    .unlock-plan-badge strong {
        font-size: 15px;
    }
}

/* ========================================
   記事本（行事曆）系統
   ======================================== */

/* 頁面標題增強 */
#calendarPage .page-header {
    display: flex;
    align-items: center;
    gap: 10px;
}

#calendarPage .page-header h1::before {
    content: '\f073';
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    margin-right: 10px;
    background: linear-gradient(135deg, #f2784b, #f89a77);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    font-size: 0.9em;
}

/* 快速新增列 */
.calendar-quick-add {
    margin-bottom: 18px;
    background: linear-gradient(135deg, #fff1e8, #fff4ee);
    border-radius: 14px;
    padding: 14px 16px;
    border: 1px solid #ffe6da;
}

.calendar-quick-add-label {
    font-size: 12px;
    font-weight: 600;
    color: #f2784b;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.calendar-quick-add-row {
    display: flex;
    gap: 8px;
}

.calendar-quick-input {
    flex: 1;
    padding: 11px 14px;
    border: 1.5px solid rgba(242, 120, 75, 0.2);
    border-radius: 10px;
    font-size: 14px;
    outline: none;
    transition: all 0.2s;
    background: #fff;
}

.calendar-quick-input:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(242, 120, 75, 0.1);
}

.calendar-quick-btn {
    padding: 11px 20px;
    background: linear-gradient(135deg, var(--primary-color), #f89a77);
    color: #fff;
    border: none;
    border-radius: 10px;
    font-size: 15px;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s;
    box-shadow: 0 2px 8px rgba(242, 120, 75, 0.3);
}

.calendar-quick-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(242, 120, 75, 0.4);
}

/* 控制列（tabs + 導航） */
.calendar-controls {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
    flex-wrap: wrap;
    gap: 10px;
}

/* 檢視模式切換 tabs */
.calendar-view-tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 12px;
    background: #F3F4F6;
    border-radius: 10px;
    padding: 3px;
}

.calendar-view-tab {
    padding: 7px 18px;
    border: none;
    border-radius: 8px;
    background: transparent;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.25s;
    color: #6B7280;
    font-weight: 500;
}

.calendar-view-tab:hover {
    color: #374151;
    background: rgba(255,255,255,0.5);
}

.calendar-view-tab.active {
    background: linear-gradient(135deg, var(--primary-color), #f89a77);
    color: #fff;
    box-shadow: 0 2px 6px rgba(242, 120, 75, 0.3);
}

/* 日期導航 */
.calendar-nav {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 16px;
}

.calendar-nav-btn {
    width: 36px;
    height: 36px;
    border: 1.5px solid #E5E7EB;
    border-radius: 10px;
    background: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    color: #6B7280;
    transition: all 0.2s;
}

.calendar-nav-btn:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
    background: #fff1e8;
}

.calendar-nav-label {
    font-size: 15px;
    font-weight: 600;
    color: #374151;
    min-width: 140px;
    text-align: center;
}

.calendar-nav-today {
    padding: 7px 16px;
    border: 1.5px solid var(--primary-color);
    border-radius: 10px;
    background: #fff;
    color: var(--primary-color);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.calendar-nav-today:hover {
    background: linear-gradient(135deg, var(--primary-color), #f89a77);
    color: #fff;
    border-color: transparent;
}

/* 行事曆統計摘要 */
.calendar-stats {
    display: flex;
    gap: 10px;
    margin-bottom: 16px;
}

.calendar-stat-card {
    flex: 1;
    background: #fff;
    border: 1px solid #E5E7EB;
    border-radius: 12px;
    padding: 12px 14px;
    text-align: center;
    transition: all 0.2s;
}

.calendar-stat-card:hover {
    border-color: var(--primary-color);
    box-shadow: 0 2px 8px rgba(242, 120, 75, 0.1);
}

.calendar-stat-num {
    font-size: 22px;
    font-weight: 700;
    background: linear-gradient(135deg, #f2784b, #f89a77);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.calendar-stat-label {
    font-size: 11px;
    color: #9CA3AF;
    margin-top: 2px;
}

/* 行事曆內容區 */
.calendar-content {
    min-height: 300px;
}

/* 日欄模式（3天/1週）*/
.cal-day-grid {
    display: grid;
    gap: 10px;
}

.cal-day-grid.view-3day {
    grid-template-columns: repeat(3, 1fr);
}

.cal-day-grid.view-week {
    grid-template-columns: repeat(7, 1fr);
}

.cal-day-col {
    background: #fff;
    border: 1.5px solid #E5E7EB;
    border-radius: 12px;
    overflow: hidden;
    min-height: 130px;
    transition: all 0.2s;
}

.cal-day-col:hover {
    border-color: #f7d3bf;
    box-shadow: 0 2px 10px rgba(242, 120, 75, 0.08);
}

.cal-day-header {
    padding: 10px 12px;
    background: #F9FAFB;
    border-bottom: 1px solid #E5E7EB;
    font-size: 13px;
    font-weight: 600;
    color: #374151;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
}

.cal-day-name {
    font-size: 11px;
    font-weight: 500;
    color: #9CA3AF;
    text-transform: uppercase;
}

.cal-day-num {
    font-size: 18px;
    font-weight: 700;
    color: #374151;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}

.cal-today-num {
    background: linear-gradient(135deg, #f2784b, #f89a77);
    color: #fff !important;
}

.cal-day-col.cal-today {
    border-color: #f7d3bf;
}

.cal-day-col.cal-today .cal-day-header {
    background: linear-gradient(135deg, #fff1e8, #fff4ee);
}

.cal-day-col.cal-today .cal-day-name {
    color: #f2784b;
}

.cal-day-body {
    padding: 8px;
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.cal-event-chip {
    padding: 7px 10px;
    background: linear-gradient(135deg, #fff1e8, #F0EBFF);
    border-radius: 8px;
    font-size: 12px;
    color: #c9542e;
    cursor: pointer;
    transition: all 0.2s;
    border-left: 3px solid var(--primary-color);
    word-break: break-word;
}

/* Google 日曆來源事件：藍色系區分（雙向同步顯示） */
.cal-event-chip.cal-event-google,
.cal-month-event.cal-event-google {
    background: linear-gradient(135deg, #E8F0FE, #DDEEFB);
    color: #1A73E8;
    border-left-color: #4285F4;
}
.cal-day-detail-item.cal-event-google {
    background: #F8FBFF;
    border-left: 3px solid #4285F4;
    padding-left: 10px;
}
.cal-event-google-icon {
    color: #4285F4;
    margin-right: 4px;
    font-size: 0.85em;
}

.cal-event-chip:hover {
    background: linear-gradient(135deg, #ffe6da, #EDE9FE);
    transform: translateX(2px);
    box-shadow: 0 2px 6px rgba(242, 120, 75, 0.15);
}

.cal-event-chip .cal-event-time {
    font-size: 11px;
    color: #e0633a;
    display: block;
    margin-bottom: 2px;
    font-weight: 600;
}

.cal-event-chip .cal-event-title {
    font-weight: 500;
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.cal-event-actions {
    display: none;
    gap: 2px;
    margin-left: auto;
    flex-shrink: 0;
}

.cal-event-chip:hover .cal-event-actions {
    display: flex;
}

.cal-action-btn {
    width: 22px;
    height: 22px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    transition: all 0.15s;
    padding: 0;
}

.cal-edit-btn {
    background: rgba(242, 120, 75, 0.15);
    color: #f2784b;
}

.cal-edit-btn:hover {
    background: rgba(242, 120, 75, 0.3);
}

.cal-del-btn {
    background: rgba(239, 68, 68, 0.12);
    color: #EF4444;
}

.cal-del-btn:hover {
    background: rgba(239, 68, 68, 0.25);
}

/* Month view: always show actions on mobile, hover on desktop */
.cal-month-event {
    display: flex;
    align-items: center;
    gap: 2px;
}

.cal-month-event-title {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.cal-month-actions .cal-action-btn {
    width: 18px;
    height: 18px;
    font-size: 9px;
}

.cal-month-event:hover .cal-month-actions {
    display: flex;
}

@media (max-width: 768px) {
    .cal-event-actions {
        display: flex;
    }
    .cal-month-actions {
        display: flex;
    }
}

.cal-empty-hint {
    font-size: 12px;
    color: #C4B5FD;
    text-align: center;
    padding: 20px 8px;
}

.cal-empty-hint::before {
    content: '\f067';
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    display: block;
    font-size: 16px;
    margin-bottom: 4px;
    opacity: 0.5;
}

.cal-add-btn {
    display: block;
    width: 100%;
    padding: 6px;
    border: 1.5px dashed #D1D5DB;
    border-radius: 6px;
    background: transparent;
    color: #9CA3AF;
    font-size: 18px;
    cursor: pointer;
    transition: all 0.2s;
    margin-top: 4px;
}

.cal-add-btn:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

/* 月曆模式 */
.cal-month-grid {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 2px;
    background: #E5E7EB;
    border: 1.5px solid #E5E7EB;
    border-radius: 12px;
    overflow: hidden;
}

.cal-month-header-cell {
    background: linear-gradient(135deg, #F3F4F6, #fff1e8);
    padding: 10px 4px;
    text-align: center;
    font-size: 12px;
    font-weight: 600;
    color: #f2784b;
}

.cal-month-cell {
    background: #fff;
    min-height: 80px;
    padding: 4px;
    cursor: pointer;
    transition: all 0.15s;
    overflow: hidden;
}

.cal-month-cell:hover {
    background: #F5F3FF;
}

.cal-month-cell.cal-today {
    background: linear-gradient(135deg, #FEFCE8, #FEF3C7);
}

.cal-month-cell.cal-month-empty {
    background: #FAFAFA;
}

.cal-month-cell.cal-other-month {
    background: #F9FAFB;
    opacity: 0.5;
}

.cal-month-day {
    font-size: 12px;
    font-weight: 600;
    color: #374151;
    padding: 2px 4px;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    margin-bottom: 2px;
}

.cal-today .cal-month-day.cal-today-num {
    background: linear-gradient(135deg, #f2784b, #f89a77);
    color: #fff;
}

.cal-month-event {
    padding: 2px 5px;
    font-size: 11px;
    background: linear-gradient(135deg, #fff1e8, #F0EBFF);
    color: #c9542e;
    border-radius: 4px;
    margin-top: 2px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    cursor: pointer;
    border-left: 2px solid #f2784b;
    transition: background 0.15s;
}

.cal-month-event:hover {
    background: #ffe6da;
}

.cal-month-more {
    font-size: 10px;
    color: #e0633a;
    padding: 2px 4px;
    margin-top: 2px;
    font-weight: 500;
}

/* 月曆手機版事件圓點 */
.cal-month-dots {
    display: none;
    flex-wrap: wrap;
    gap: 3px;
    padding: 2px 0;
    justify-content: center;
}
.cal-month-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #f2784b;
}
.cal-month-dot-more {
    font-size: 8px;
    color: #e0633a;
    font-weight: 600;
    line-height: 6px;
}

/* 日期詳情彈窗 */
.cal-day-detail-card {
    background: #fff;
    border-radius: 16px;
    width: 92%;
    max-width: 380px;
    max-height: 70vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 60px rgba(0,0,0,0.25);
    animation: calModalIn 0.2s ease-out;
}
.cal-day-detail-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px 12px;
    border-bottom: 1px solid #F3F4F6;
}
.cal-day-detail-header h3 {
    margin: 0;
    font-size: 1.05rem;
    font-weight: 700;
    color: #1F2937;
}
.cal-day-detail-body {
    flex: 1;
    overflow-y: auto;
    padding: 12px 16px;
}
.cal-day-detail-empty {
    text-align: center;
    padding: 24px 16px;
    color: #9CA3AF;
    font-size: 14px;
}
.cal-day-detail-item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 10px;
    border-radius: 10px;
    transition: background 0.15s;
    border-left: 3px solid #f2784b;
    margin-bottom: 8px;
    background: #FAFBFF;
}
.cal-day-detail-item:hover {
    background: #fff1e8;
}
.cal-day-detail-info {
    flex: 1;
    min-width: 0;
}
.cal-day-detail-title {
    font-size: 14px;
    font-weight: 600;
    color: #1F2937;
    margin-bottom: 2px;
}
.cal-day-detail-time {
    font-size: 12px;
    color: #6B7280;
}
.cal-day-detail-note {
    font-size: 12px;
    color: #9CA3AF;
    margin-top: 2px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.cal-day-detail-actions {
    display: flex;
    gap: 4px;
    flex-shrink: 0;
}
.cal-day-detail-actions .cal-action-btn {
    width: 30px;
    height: 30px;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    transition: all 0.15s;
}
.cal-day-detail-actions .cal-edit-btn {
    background: #fff1e8;
    color: #f2784b;
}
.cal-day-detail-actions .cal-edit-btn:hover {
    background: #f7d3bf;
}
.cal-day-detail-actions .cal-del-btn {
    background: #FEF2F2;
    color: #EF4444;
}
.cal-day-detail-actions .cal-del-btn:hover {
    background: #FECACA;
}
.cal-day-detail-footer {
    padding: 12px 16px;
    border-top: 1px solid #F3F4F6;
}
.cal-day-detail-add-btn {
    width: 100%;
    padding: 10px;
    border: 2px dashed #D1D5DB;
    border-radius: 10px;
    background: transparent;
    color: #f2784b;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}
.cal-day-detail-add-btn:hover {
    border-color: #f2784b;
    background: #fff1e8;
}

/* 升級提示 */
.cal-upgrade-hint {
    text-align: center;
    padding: 60px 20px;
    color: #6B7280;
}

.cal-upgrade-hint i {
    font-size: 48px;
    color: #D1D5DB;
    margin-bottom: 16px;
}

.cal-upgrade-hint h3 {
    font-size: 18px;
    color: #374151;
    margin-bottom: 8px;
}

.cal-upgrade-hint p {
    margin-bottom: 20px;
}

.cal-upgrade-hint .btn-upgrade {
    padding: 10px 24px;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    color: #fff;
    border: none;
    border-radius: 10px;
    font-size: 14px;
    cursor: pointer;
}

/* Modal 彈窗 */
.calendar-modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.4);
    z-index: 1200;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.calendar-modal-card {
    background: #fff;
    border-radius: 16px;
    width: 100%;
    max-width: 420px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.15);
    overflow: hidden;
}

.calendar-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid #F3F4F6;
}

.calendar-modal-header h3 {
    font-size: 16px;
    margin: 0;
    color: #374151;
}

.calendar-modal-close {
    width: 32px;
    height: 32px;
    border: none;
    background: #F3F4F6;
    border-radius: 50%;
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #6B7280;
    transition: all 0.2s;
}

.calendar-modal-close:hover {
    background: #E5E7EB;
}

.calendar-modal-body {
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.calendar-modal-body label {
    font-size: 13px;
    font-weight: 600;
    color: #374151;
}

.calendar-modal-input {
    width: 100%;
    padding: 10px 12px;
    border: 1.5px solid #E5E7EB;
    border-radius: 8px;
    font-size: 14px;
    outline: none;
    box-sizing: border-box;
    transition: border-color 0.2s;
}

.calendar-modal-input:focus {
    border-color: var(--primary-color);
}

.calendar-modal-textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1.5px solid #E5E7EB;
    border-radius: 8px;
    font-size: 14px;
    outline: none;
    resize: vertical;
    box-sizing: border-box;
    font-family: inherit;
}

.calendar-modal-textarea:focus {
    border-color: var(--primary-color);
}

.calendar-modal-row {
    display: flex;
    gap: 12px;
}

.calendar-modal-col {
    flex: 1;
}

.calendar-checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: #374151;
    cursor: pointer;
}

.calendar-checkbox-label input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--primary-color);
}

.calendar-modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 16px 20px;
    border-top: 1px solid #F3F4F6;
}

.calendar-modal-btn-cancel {
    padding: 9px 20px;
    border: 1.5px solid #E5E7EB;
    border-radius: 8px;
    background: #fff;
    color: #6B7280;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
}

.calendar-modal-btn-cancel:hover {
    background: #F3F4F6;
}

.calendar-modal-btn-save {
    padding: 9px 20px;
    border: none;
    border-radius: 8px;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    color: #fff;
    font-size: 14px;
    cursor: pointer;
    transition: opacity 0.2s;
}

.calendar-modal-btn-save:hover {
    opacity: 0.9;
}

.calendar-modal-btn-delete {
    padding: 9px 20px;
    border: none;
    border-radius: 8px;
    background: #EF4444;
    color: #fff;
    font-size: 14px;
    cursor: pointer;
    margin-right: auto;
    transition: opacity 0.2s;
}

.calendar-modal-btn-delete:hover {
    opacity: 0.9;
}

/* 聊天中的行事曆通知卡片 */
.cal-chat-notification {
    background: linear-gradient(135deg, #fff1e8, #F0EBFF);
    border: 1px solid #f7d3bf;
    border-radius: 12px;
    padding: 12px 16px;
    margin: 8px 0;
    font-size: 13px;
    color: #c9542e;
}

.cal-chat-notification strong {
    display: block;
    margin-bottom: 4px;
}

/* 今日行事曆提醒卡片（歡迎訊息中） */
.cal-reminder-card {
    background: linear-gradient(135deg, #fff1e8, #fff4ee);
    border: 1px solid #ffe6da;
    border-radius: 14px;
    padding: 14px 18px;
    margin: 8px 0;
    animation: careSlideIn 0.5s ease-out;
}

.cal-reminder-card .cal-reminder-title {
    font-size: 13px;
    font-weight: 600;
    color: #f2784b;
    margin-bottom: 8px;
}

.cal-reminder-card .cal-reminder-item {
    font-size: 13px;
    color: #374151;
    padding: 4px 0;
    border-bottom: 1px solid rgba(242, 120, 75, 0.1);
}

.cal-reminder-card .cal-reminder-item:last-child {
    border-bottom: none;
}

.cal-reminder-card .cal-reminder-item .cal-r-time {
    color: #e0633a;
    font-weight: 600;
    margin-right: 6px;
}

/* 手機版響應式 */
@media (max-width: 768px) {
    .cal-day-grid.view-3day {
        grid-template-columns: 1fr;
    }

    .cal-day-grid.view-week {
        grid-template-columns: repeat(3, 1fr);
    }

    .cal-month-cell {
        min-height: 48px;
        padding: 3px 2px;
    }

    .cal-month-header-cell {
        padding: 6px 2px;
        font-size: 11px;
    }

    .cal-month-day {
        font-size: 11px;
        width: 20px;
        height: 20px;
        margin-bottom: 1px;
    }

    /* 手機版隱藏內嵌事件，改顯示圓點 */
    .cal-month-event,
    .cal-month-more {
        display: none;
    }
    .cal-month-dots {
        display: flex;
    }

    .calendar-quick-add-row {
        flex-direction: column;
    }

    .calendar-modal-row {
        flex-direction: column;
        gap: 8px;
    }

    .calendar-view-tabs {
        flex-wrap: wrap;
    }
}

/* ========================================
   Voice Call Modal（Gemini Live MVP）
   ======================================== */
.voice-call-btn {
    color: #16a34a;
}
.voice-call-btn:hover {
    background: rgba(22, 163, 74, 0.12);
}

.voice-call-modal-card {
    text-align: center;
}

.voice-call-header {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-weight: 700;
    font-size: 1.15rem;
    color: #16a34a;
    margin-bottom: 16px;
}

.voice-call-status {
    font-size: 0.95rem;
    color: #475569;
    margin: 12px 0;
    min-height: 1.4em;
}

.voice-call-timer {
    font-size: 2.4rem;
    font-weight: 800;
    color: #16a34a;
    font-variant-numeric: tabular-nums;
    margin: 16px 0;
}

.voice-call-quota {
    font-size: 0.85rem;
    color: #64748b;
    margin: 8px 0 16px;
}

.voice-call-error {
    background: #fef2f2;
    color: #b91c1c;
    border: 1px solid #fecaca;
    border-radius: 8px;
    padding: 8px 12px;
    margin: 12px 0;
    font-size: 0.85rem;
}

.voice-call-actions {
    display: flex;
    gap: 8px;
    justify-content: center;
    margin-top: 16px;
}

.voice-call-btn-primary,
.voice-call-btn-danger,
.voice-call-btn-secondary,
.voice-call-btn-toggle {
    padding: 10px 22px;
    border-radius: 8px;
    border: none;
    font-weight: 600;
    cursor: pointer;
    font-size: 0.95rem;
    transition: opacity 0.15s, background 0.15s, color 0.15s;
}

/* 擴音切換按鈕：active 時藍底白字（擴音中）/ 非 active 時淡灰底深字（聽筒）*/
.voice-call-btn-toggle {
    background: #f1f5f9;
    color: #64748b;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.voice-call-btn-toggle i {
    font-size: 0.95rem;
}
.voice-call-btn-toggle:hover {
    background: #e2e8f0;
}
.voice-call-btn-toggle.voice-call-btn-toggle-active {
    background: #f2784b;
    color: white;
}
.voice-call-btn-toggle.voice-call-btn-toggle-active:hover {
    background: #e0633a;
}

.voice-call-btn-primary {
    background: #16a34a;
    color: white;
}
.voice-call-btn-primary:hover { opacity: 0.9; }
.voice-call-btn-primary:disabled { background: #94a3b8; cursor: not-allowed; }

.voice-call-btn-danger {
    background: #dc2626;
    color: white;
}
.voice-call-btn-danger:hover { opacity: 0.9; }

.voice-call-btn-secondary {
    background: #f1f5f9;
    color: #475569;
}
.voice-call-btn-secondary:hover { background: #e2e8f0; }

.voice-call-hint {
    font-size: 0.78rem;
    color: #94a3b8;
    margin-top: 14px;
    line-height: 1.4;
}
.voice-call-hint i {
    margin-right: 4px;
}

/* ========================================
   Voice Call Modal — 通話 Layout（自洽元件）
   頭像影片內嵌於 modal 最上方，整個 modal 即為一個完整通話介面
   不再依賴外部 chat-avatar 放大、不需 z-index hack、不需動態定位
   ======================================== */
.voice-call-overlay {
    /* 沿用 .modal-overlay 預設置中行為；只需覆寫遮罩淡一點 */
    background: rgba(0, 0, 0, 0.4) !important;
}

.voice-call-overlay .voice-call-modal-card {
    width: calc(100% - 32px);
    max-width: 380px !important;
    border-radius: 24px;
    padding: 0 1.5rem 1.5rem;
    /* 滑入動畫：從稍下方淡入 */
    animation: voiceCallFadeIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    /* 防止內容超出 viewport（小螢幕）*/
    max-height: calc(100vh - 40px);
    max-height: calc(100dvh - 40px);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

@keyframes voiceCallFadeIn {
    from { transform: translateY(20px); opacity: 0; }
    to   { transform: translateY(0); opacity: 1; }
}

/* 頭像影片容器：modal 內最上方的大圓形 */
.voice-call-avatar-wrap {
    width: 200px;
    height: 200px;
    border-radius: 50%;
    overflow: hidden;
    margin: 1.75rem auto 1.25rem;
    position: relative;
    background: #f1f5f9;
    border: 4px solid white;
    box-shadow: 0 8px 24px rgba(242, 120, 75, 0.25);
}

.voice-call-avatar-image,
.voice-call-avatar-video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* 小螢幕（< 380px 寬）— 縮小頭像確保按鈕仍可見 */
@media (max-height: 700px) {
    .voice-call-avatar-wrap {
        width: 160px;
        height: 160px;
        margin: 1.25rem auto 1rem;
    }
}

@media (max-height: 600px) {
    .voice-call-avatar-wrap {
        width: 120px;
        height: 120px;
        margin: 1rem auto 0.75rem;
    }
}

/* ========================================
   Iris 客服助理 — 站內客服中心嵌入式對話框
   ======================================== */

.iris-chat-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 20px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.iris-chat-header {
    display: flex;
    align-items: center;
    gap: 14px;
}

.iris-avatar {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    object-fit: cover;
    background: #f3f4f6;
    flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(248, 154, 119, 0.18);
}

.iris-header-info {
    flex: 1;
    min-width: 0;
}

.iris-name {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 8px;
}

.iris-badge {
    font-size: 0.7rem;
    font-weight: 500;
    background: linear-gradient(135deg, #f89a77, #e8857b);
    color: #fff;
    padding: 2px 8px;
    border-radius: 10px;
}

.iris-tagline {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-top: 2px;
}

.iris-chat-messages {
    background: #f9fafb;
    border-radius: 10px;
    padding: 12px;
    min-height: 80px;
    max-height: 340px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.iris-msg {
    max-width: 86%;
    padding: 8px 12px;
    border-radius: 12px;
    font-size: 0.92rem;
    line-height: 1.5;
    word-wrap: break-word;
    white-space: pre-wrap;
}

.iris-msg-user {
    align-self: flex-end;
    background: linear-gradient(135deg, #f89a77, #e8857b);
    color: #fff;
    border-bottom-right-radius: 4px;
}

.iris-msg-bot {
    align-self: flex-start;
    background: #fff;
    color: var(--text-primary);
    border: 1px solid #e5e7eb;
    border-bottom-left-radius: 4px;
}

.iris-msg-bot strong { font-weight: 600; }

/* bot 泡泡改走 Markdown HTML 排版：覆蓋 .iris-msg 的 pre-wrap，避免區塊間多出空行 */
.iris-msg-bot { white-space: normal; }
.iris-msg-bot p { margin: 0 0 8px; }
.iris-msg-bot p:last-child { margin-bottom: 0; }
.iris-msg-bot ul,
.iris-msg-bot ol { margin: 4px 0; padding-left: 1.45em; }
.iris-msg-bot li { margin: 2px 0; }
.iris-msg-bot li > p { margin: 0; }
.iris-msg-bot h1,
.iris-msg-bot h2,
.iris-msg-bot h3,
.iris-msg-bot h4,
.iris-msg-bot h5,
.iris-msg-bot h6 { font-size: 1em; font-weight: 600; margin: 6px 0 4px; }
.iris-msg-bot code {
    background: #f3f4f6;
    padding: 1px 5px;
    border-radius: 4px;
    font-size: 0.88em;
}
.iris-msg-bot pre {
    background: #f3f4f6;
    padding: 8px 10px;
    border-radius: 8px;
    overflow-x: auto;
    margin: 6px 0;
}
.iris-msg-bot pre code { background: none; padding: 0; }
.iris-msg-bot a { color: #e0633a; text-decoration: underline; word-break: break-all; }
.iris-msg-bot blockquote {
    margin: 6px 0;
    padding-left: 10px;
    border-left: 3px solid #e5e7eb;
    color: var(--text-secondary);
}

.iris-msg-typing {
    align-self: flex-start;
    color: var(--text-secondary);
    font-size: 0.85rem;
    font-style: italic;
    padding: 4px 0;
}

.iris-form-hint {
    align-self: flex-start;
    background: #fef3c7;
    border: 1px solid #fcd34d;
    color: #92400e;
    padding: 8px 12px;
    border-radius: 10px;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    gap: 8px;
    max-width: 86%;
}

.iris-form-hint button {
    background: #f59e0b;
    color: #fff;
    border: none;
    padding: 5px 12px;
    border-radius: 6px;
    font-size: 0.82rem;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.15s;
}

.iris-form-hint button:hover {
    background: #d97706;
}

.iris-chat-input-row {
    display: flex;
    gap: 8px;
    align-items: stretch;
}

.iris-chat-input {
    flex: 1;
    padding: 10px 14px;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    font-size: 0.95rem;
    outline: none;
    transition: border-color 0.15s;
}

.iris-chat-input:focus {
    border-color: #f89a77;
}

.iris-chat-input:disabled {
    background: #f3f4f6;
    color: #9ca3af;
    cursor: not-allowed;
}

.iris-send-btn {
    background: linear-gradient(135deg, #f89a77, #e8857b);
    color: #fff;
    border: none;
    padding: 10px 18px;
    border-radius: 10px;
    font-size: 0.92rem;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: transform 0.1s, opacity 0.15s;
}

.iris-send-btn:hover:not(:disabled) {
    transform: translateY(-1px);
}

.iris-send-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

@media (max-width: 640px) {
    .iris-chat-card { padding: 16px; gap: 12px; }
    .iris-chat-header { gap: 10px; }
    .iris-avatar { width: 52px; height: 52px; }
    .iris-name { font-size: 1rem; }
    .iris-tagline { font-size: 0.78rem; line-height: 1.35; }
    .iris-send-btn span { display: none; }
    .iris-send-btn { padding: 10px 14px; }
    .iris-chat-messages { max-height: 280px; padding: 10px; }
    .iris-msg { max-width: 92%; font-size: 0.9rem; padding: 7px 11px; }
    .iris-chat-input { padding: 9px 12px; font-size: 0.92rem; }
}

/* 超窄螢幕（<= 380px） — 進一步壓縮確保撥話按鈕仍能顯示 */
@media (max-width: 380px) {
    .iris-chat-card { padding: 14px; }
    .iris-chat-header { gap: 8px; }
    .iris-avatar { width: 46px; height: 46px; }
    .iris-name { font-size: 0.95rem; }
    .iris-tagline { font-size: 0.72rem; }
    .iris-badge { font-size: 0.65rem; padding: 1px 6px; }
}

/* ========================================
   Iris 撥話按鈕（嵌在 chat card header 右側）
   ======================================== */

.iris-voice-call-btn {
    flex-shrink: 0;
    background: linear-gradient(135deg, #22c55e, #16a34a);
    color: #fff;
    border: none;
    border-radius: 24px;
    padding: 8px 16px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: transform 0.1s, box-shadow 0.15s;
    box-shadow: 0 2px 6px rgba(34, 197, 94, 0.25);
}

.iris-voice-call-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 10px rgba(34, 197, 94, 0.35);
}

.iris-voice-call-btn:disabled {
    background: #d1d5db;
    color: #9ca3af;
    cursor: not-allowed;
    box-shadow: none;
}

.iris-voice-call-btn i { font-size: 0.95rem; }

/* Iris 通話 modal 副標題 */
.iris-voice-subtitle {
    color: #9ca3af;
    font-size: 0.82rem;
    margin-top: -4px;
}

/* Iris 通話 modal 倒數計時：60→00 用紅色提醒緊迫感（最後 15 秒） */
.iris-voice-overlay #irisVoiceTimer.iris-voice-urgent {
    color: #dc2626;
    animation: irisVoicePulse 1s ease-in-out infinite;
}

@keyframes irisVoicePulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.08); }
}

@media (max-width: 640px) {
    /* 撥話按鈕：手機版改為純 icon 圓形（節省 chat header 空間） */
    .iris-voice-call-btn span { display: none; }
    .iris-voice-call-btn {
        padding: 0;
        width: 40px;
        height: 40px;
        border-radius: 50%;
        justify-content: center;
    }
    .iris-voice-call-btn i { font-size: 1rem; }
    .iris-voice-subtitle { font-size: 0.75rem; }
    /* 通話 modal 計時器在手機字體稍縮，避免擠到狀態文字 */
    .iris-voice-overlay #irisVoiceTimer { font-size: 1.6rem; }
}

@media (max-width: 380px) {
    /* 超窄螢幕：撥話按鈕再縮一點，確保和 header 容得下 */
    .iris-voice-call-btn { width: 36px; height: 36px; }
    .iris-voice-call-btn i { font-size: 0.92rem; }
}

/* ========================================
   站內客服中心 — 淡粉紅溫馨主題
   ======================================== */

#feedbackPage {
    background: linear-gradient(180deg, #fff5f8 0%, #fff0f5 50%, #ffe8ef 100%);
    border-radius: 16px;
    padding: 24px 20px;
    min-height: 100%;
    box-shadow: inset 0 0 40px rgba(232, 133, 123, 0.04);
}

/* page header 文字微調，與粉色底搭配 */
#feedbackPage .page-header {
    padding: 4px 4px 0;
    margin-bottom: 18px;
}

#feedbackPage .page-header h1 {
    color: #e8857b;
    text-shadow: 0 1px 2px rgba(232, 133, 123, 0.08);
}

#feedbackPage .page-header p {
    color: #c25b54;
}

/* Iris chat card 在粉底上保持白色，加柔和粉色 shadow */
#feedbackPage .iris-chat-card {
    background: #ffffff;
    border-color: rgba(232, 133, 123, 0.15);
    box-shadow: 0 4px 16px rgba(232, 133, 123, 0.08);
}

#feedbackPage .iris-chat-messages {
    background: #fffafc;  /* 訊息區帶極微粉，比 card 底色更柔 */
}

/* Iris bot 訊息泡泡邊框微帶粉 */
#feedbackPage .iris-msg-bot {
    border-color: #fce7f0;
}

/* 提交意見 / 回饋歷史卡片：與 Iris card 同層次 */
#feedbackPage .feedback-form-card,
#feedbackPage .feedback-history-card {
    background: #ffffff;
    border-color: rgba(232, 133, 123, 0.15);
    box-shadow: 0 4px 16px rgba(232, 133, 123, 0.08);
}

/* 表單 input / select / textarea 在粉色頁面上微調 focus 色 */
#feedbackPage .form-select:focus,
#feedbackPage .form-textarea:focus,
#feedbackPage .form-input:focus {
    border-color: #e8857b;
    box-shadow: 0 0 0 3px rgba(232, 133, 123, 0.12);
}

/* 截圖上傳區拖放邊框配色 */
#feedbackPage .screenshot-upload-zone {
    border-color: rgba(232, 133, 123, 0.25);
    background: #fffafc;
}

#feedbackPage .screenshot-upload-zone:hover {
    border-color: #e8857b;
    background: #fff5f8;
}

@media (max-width: 640px) {
    #feedbackPage {
        padding: 16px 12px;
        border-radius: 12px;
    }
}

/* ============================================
 * 加購撥話時間（Voice Call Top-up）
 * ============================================ */

#voiceCallTopupSection .topup-balance-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: linear-gradient(135deg, #fef3c7 0%, #ffe9df 100%);
    border-radius: 10px;
    margin-bottom: 14px;
    font-size: 0.9rem;
}

#voiceCallTopupSection .topup-balance-bar i {
    color: #d97706;
    margin-right: 6px;
}

#voiceCallTopupSection .topup-balance-bar strong {
    font-size: 1.05rem;
    color: #c25b54;
}

#voiceCallTopupSection .topup-packages {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 12px;
    margin-bottom: 12px;
}

.topup-pkg-card {
    position: relative;
    background: #ffffff;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    padding: 16px 14px;
    text-align: center;
    transition: all 0.2s ease;
}

.topup-pkg-card.has-discount {
    border-color: #f59e0b;
    background: linear-gradient(180deg, #fffbeb 0%, #ffffff 60%);
}

.topup-pkg-card:hover {
    border-color: #f2784b;
    box-shadow: 0 4px 14px rgba(242, 120, 75, 0.12);
    transform: translateY(-2px);
}

.topup-discount-badge {
    position: absolute;
    top: -10px;
    right: 10px;
    background: #f59e0b;
    color: white;
    padding: 3px 10px;
    font-size: 0.7rem;
    font-weight: 700;
    border-radius: 12px;
    letter-spacing: 0.3px;
}

.topup-pkg-title {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 6px;
    font-weight: 600;
}

.topup-pkg-minutes {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.topup-pkg-minutes span {
    font-size: 0.85rem;
    color: var(--text-secondary);
    font-weight: 400;
    margin-left: 4px;
}

.topup-pkg-price {
    font-size: 0.95rem;
    font-weight: 700;
    color: #c25b54;
    margin-bottom: 12px;
}

.topup-pkg-price-usd {
    font-size: 0.75rem;
    color: var(--text-light);
    font-weight: 500;
    display: block;
    margin-top: 2px;
}

.topup-pkg-buttons {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.topup-buy-btn,
.topup-buy-btn-secondary {
    width: 100%;
    padding: 8px 10px;
    font-size: 0.8rem;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.topup-buy-btn {
    background: #f2784b;
    color: white;
    border: 1px solid #f2784b;
}

.topup-buy-btn:hover {
    background: #e0633a;
    border-color: #e0633a;
}

.topup-buy-btn-secondary {
    background: white;
    color: #475569;
    border: 1px solid #cbd5e1;
}

.topup-buy-btn-secondary:hover {
    background: #f1f5f9;
    color: #334155;
    border-color: #94a3b8;
}

.topup-locked-hint {
    padding: 14px 16px;
    background: var(--bg-secondary);
    border-radius: 10px;
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.topup-locked-hint a {
    color: #f2784b;
    font-weight: 600;
    text-decoration: underline;
}

@media (max-width: 640px) {
    #voiceCallTopupSection .topup-packages {
        grid-template-columns: 1fr;
    }
    .topup-pkg-minutes {
        font-size: 1.5rem;
    }
}


/* ============================================
   樂齡 emoji 大頭像 + 設定說明（Phase 1 換皮）
   ============================================ */
.settings-hint {
    color: var(--text-secondary);
    font-size: 0.95rem;
    margin: -4px 0 14px;
    line-height: 1.6;
}
.leling-avatar-grid {
    grid-template-columns: repeat(auto-fill, minmax(78px, 1fr));
    gap: 14px;
}
.leling-avatar-emoji {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.6rem;
    line-height: 1;
    background: var(--coral-soft, #FFE6DA);
    border-radius: 8px;
    -webkit-user-select: none;
    user-select: none;
}


/* ============================================
   家屬安心儀表板（§6.1）
   ============================================ */
.family-bind-form {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
}
.family-input {
    padding: 12px 14px;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    font-size: 1.05rem;
    min-width: 220px;
    flex: 1;
}
.family-elders-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 16px;
}
.family-empty {
    color: var(--text-secondary);
    padding: 12px 0;
}
.family-elder-card,
.family-request-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    padding: 18px 20px;
    box-shadow: var(--shadow-sm);
}
.family-request-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
}
.family-request-actions { display: flex; gap: 8px; }
.family-elder-head {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.15rem;
    margin-bottom: 14px;
}
.family-relation { color: var(--text-secondary); font-size: 0.9rem; }
.family-sub { color: var(--text-secondary); font-size: 0.85rem; margin-top: 2px; }
.family-status-dot {
    width: 14px; height: 14px; border-radius: 50%;
    flex: 0 0 auto; display: inline-block;
}
.family-status-dot.green { background: #5BA37A; box-shadow: 0 0 0 4px rgba(91,163,122,0.18); }
.family-status-dot.amber { background: var(--amber, #E8A23D); box-shadow: 0 0 0 4px rgba(232,162,61,0.18); }
.family-status-dot.red { background: var(--coral, #F2784B); box-shadow: 0 0 0 4px rgba(242,120,75,0.20); }
.family-unbind {
    margin-left: auto;
    background: none; border: none; color: var(--text-light);
    cursor: pointer; font-size: 1rem;
}
.family-unbind:hover { color: var(--coral, #F2784B); }
.family-signals {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 10px;
}
.family-signal {
    background: var(--bg-warm, #FFF1E8);
    border-radius: 12px;
    padding: 10px 12px;
}
.family-signal span { display: block; color: var(--text-secondary); font-size: 0.82rem; }
.family-signal b { font-size: 1rem; }
.family-signal.warn { background: rgba(242,120,75,0.12); }
.family-signal.warn b { color: var(--coral-dark, #E0633A); }
.family-signal.muted b { color: var(--text-light); font-weight: 500; }


/* ============================================
   提醒（§6.3 用藥/回診/量測）
   ============================================ */
.reminder-kind-picker { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.reminder-kind-btn {
    padding: 12px 18px; border: 2px solid var(--border-color); border-radius: 14px;
    background: var(--card-bg); font-size: 1.05rem; cursor: pointer; transition: var(--transition);
}
.reminder-kind-btn.selected {
    border-color: var(--coral, #F2784B); background: var(--coral-soft, #FFE6DA); font-weight: 700;
}
.reminder-form { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.reminders-list { display: flex; flex-direction: column; gap: 12px; }
.reminder-card {
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    background: var(--card-bg); border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg); padding: 16px 18px; box-shadow: var(--shadow-sm);
}
.reminder-card.inactive { opacity: 0.55; }
.reminder-card-main { display: flex; align-items: center; gap: 14px; }
.reminder-icon { font-size: 2rem; line-height: 1; }
.reminder-title { font-size: 1.2rem; font-weight: 700; }
.reminder-when { color: var(--text-secondary); font-size: 0.95rem; }
.reminder-actions { display: flex; align-items: center; gap: 8px; }
.reminder-done-btn { white-space: nowrap; }
.reminder-icon-btn { background: none; border: none; color: var(--text-light); cursor: pointer; font-size: 1.2rem; padding: 6px; }
.reminder-icon-btn:hover { color: var(--coral, #F2784B); }


/* ============================================
   家屬主動警示（§6.4）
   ============================================ */
.nav-alert-badge {
    margin-left: auto; background: var(--coral, #F2784B); color: #fff;
    font-size: 0.78rem; font-weight: 700; min-width: 20px; height: 20px;
    border-radius: 10px; display: inline-flex; align-items: center; justify-content: center; padding: 0 6px;
}
.family-alerts-banner { display: flex; flex-direction: column; gap: 10px; margin-bottom: 18px; }
.family-alert {
    display: flex; align-items: center; gap: 10px; padding: 14px 16px;
    border-radius: var(--border-radius-lg); font-size: 1.05rem; font-weight: 600;
}
.family-alert i { font-size: 1.2rem; flex: 0 0 auto; }
.family-alert-high { background: rgba(242, 120, 75, 0.14); color: var(--coral-dark, #E0633A); border: 1px solid rgba(242, 120, 75, 0.3); }
.family-alert-medium { background: var(--bg-warm, #FFF1E8); color: var(--text-primary); border: 1px solid var(--border-color); }
.family-threshold { margin-top: 12px; font-size: 0.95rem; color: var(--text-secondary); display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.family-threshold select { padding: 6px 10px; border: 1px solid var(--border-color); border-radius: 10px; font-size: 0.95rem; }


/* ============================================
   生命故事冊（§6.6）
   ============================================ */
.memoir-prompt {
    font-size: 1.25rem; font-weight: 700; color: var(--coral-dark, #E0633A);
    background: var(--coral-soft, #FFE6DA); border-radius: var(--border-radius-lg);
    padding: 16px 18px; line-height: 1.7;
}
.memoir-change-btn { margin: 12px 0; }
.memoir-textarea {
    width: 100%; min-height: 140px; padding: 14px; font-size: 1.1rem; line-height: 1.8;
    border: 1px solid var(--border-color); border-radius: var(--border-radius-lg);
    margin-bottom: 12px; font-family: inherit; resize: vertical;
}
.memoir-list-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.memoir-list { display: flex; flex-direction: column; gap: 14px; margin-top: 12px; }
.memoir-card {
    background: var(--card-bg); border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg); padding: 16px 18px; box-shadow: var(--shadow-sm);
}
.memoir-q { font-weight: 700; color: var(--coral-dark, #E0633A); margin-bottom: 8px; }
.memoir-a { font-size: 1.1rem; line-height: 1.9; }
.memoir-meta { display: flex; align-items: center; justify-content: space-between; margin-top: 10px; color: var(--text-light); font-size: 0.9rem; }


/* §6.3 拍藥袋讀單結果 */
.med-label-result { margin-top: 14px; padding: 16px 18px; background: var(--coral-soft, #FFE6DA); border-radius: var(--border-radius-lg); font-size: 1.1rem; line-height: 1.9; }
.med-label-loading { color: var(--text-secondary); }
