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

/* === CSS 變數（全域設定） === */
:root {
    /* 主色調 */
    --primary-color: #6366F1;       /* Indigo */
    --primary-light: #818CF8;
    --primary-dark: #4F46E5;

    /* 輔助色 */
    --secondary-color: #EC4899;     /* Pink */
    --accent-color: #10B981;        /* Emerald */

    /* 背景色 */
    --bg-color: #F8FAFC;
    --bg-dark: #0F172A;
    --card-bg: #FFFFFF;

    /* 文字色 */
    --text-primary: #1E293B;
    --text-secondary: #64748B;
    --text-light: #94A3B8;

    /* 邊框和陰影 */
    --border-color: #E2E8F0;
    --border-radius: 12px;
    --border-radius-lg: 20px;

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1);

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

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

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

body {
    font-family: 'Inter', 'Noto Sans TC', -apple-system, BlinkMacSystemFont, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-primary);
    line-height: 1.6;
    -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(99, 102, 241, 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-ghost {
    background: transparent;
    color: var(--text-secondary);
}

.btn-ghost:hover {
    color: var(--primary-color);
    background: rgba(99, 102, 241, 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(99, 102, 241, 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 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;
}

/* 手機版認證頁面適配 */
@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(99, 102, 241, 0.1);
    color: var(--primary-color);
}

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

.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(99, 102, 241, 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(99, 102, 241, 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), #818cf8);
    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;
}

/* 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;
}

/* 同步按鈕的 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(99, 102, 241, 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(99, 102, 241, 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-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 12px;
}

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

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

.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(99, 102, 241, 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;
}

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

.avatar-upload-card:hover {
    border-color: var(--primary-color);
    background: rgba(99, 102, 241, 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: 50%;
}

.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(99, 102, 241, 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: 50%;
}

.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(99, 102, 241, 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, #6366F1, #818CF8);
    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;
}

/* === 訂閱方案頁面 === */
.billing-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-bottom: 30px;
}

.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);
}

/* 方案卡片網格 */
.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;
}

.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;
}

.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;
}

.chat-avatar.listening .pulse-ring {
    animation: pulse-animation 1s infinite;
    background: rgba(236, 72, 153, 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: 45px;
    height: 45px;
    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(236, 72, 153, 0.7); }
    70% { box-shadow: 0 0 0 10px rgba(236, 72, 153, 0); }
    100% { box-shadow: 0 0 0 0 rgba(236, 72, 153, 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;
    font-size: 0.9rem;
    line-height: 1.5;
}

.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;
    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: #EEF2FF;
    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: 15px;
    display: flex;
    gap: 8px;
    z-index: 2;
}

.chat-toolbar-btn {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    font-size: 0.85rem;
    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(99, 102, 241, 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: #EEF2FF;
    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: #EC4899;
}

.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: #10b981;
    color: white;
    border-color: #10b981;
}

/* === 訊息按鈕群組（複製 + 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: #10b981;
    color: white;
    border-color: #10b981;
}

/* === 微信分享按鈕 === */
.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: #10b981;
    color: white;
    border-color: #10b981;
}

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

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

.screenshot-btn.copied {
    background: #10b981;
    color: white;
    border-color: #10b981;
}

.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(99, 102, 241, 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: 20px;
        padding-top: 64px; /* 為 toggle 按鈕留空間 */
    }

    .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;
}

/* 助理頭像生命感動畫 */
.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-include-purchaser {
    margin: 0.5rem 0 0.8rem;
    padding: 0 0.5rem;
}

.enterprise-include-purchaser .checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
    color: #555;
    cursor: pointer;
}

.enterprise-include-purchaser input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--primary, #6366f1);
}

/* 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: #6366F1;
    transform: scale(1.2);
}
.onboarding-step-dot.done {
    background: #10B981;
}
.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: #A5B4FC;
    background: #F5F3FF;
}
.onboard-persona.selected {
    border-color: #6366F1;
    background: #EEF2FF;
    box-shadow: 0 0 0 3px rgba(99,102,241,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: #6366F1;
}

/* 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: #6366F1;
    font-size: 1rem;
    flex-shrink: 0;
}
.onboard-suggestion:hover {
    border-color: #A5B4FC;
    background: #EEF2FF;
}

/* Onboarding — 按鈕 */
.onboard-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 32px;
    background: linear-gradient(135deg, #6366F1, #818CF8);
    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(99,102,241,0.3);
}
.onboard-btn-next {
    margin-top: 10px;
    background: white;
    color: #6366F1;
    border: 2px solid #6366F1;
}
.onboard-btn-next:hover {
    background: #EEF2FF;
    box-shadow: 0 4px 12px rgba(99,102,241,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: #6366F1;
}

/* 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: #8b5cf6;
}

.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(99, 102, 241, 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(99, 102, 241, 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(99, 102, 241, 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;
}

/* ============================================
   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, #6366F1, #818CF8);
}

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

.usage-plan-badge.tier-standard {
    background: linear-gradient(135deg, #6366F1, #818CF8);
}

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

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

.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, #6366F1, #818CF8);
    transition: width 0.6s ease;
}

.usage-progress-fill.usage-progress-green {
    background: linear-gradient(90deg, #10B981, #34D399);
}

.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: #10B981;
}

.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, #EEF2FF, #E0E7FF);
    border: 1px solid #C7D2FE;
}

.usage-upgrade-inner > i {
    font-size: 1.5rem;
    color: #6366F1;
    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: #4338CA;
    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(99, 102, 241, 0.18), 0 2px 12px rgba(0,0,0,0.08);
    border: 1px solid rgba(99, 102, 241, 0.15);
}
.email-verify-icon {
    font-size: 56px;
    color: #6366F1;
    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: #6366F1;
}
.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, #6366F1, #818CF8);
    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: #10B981;
}
.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, #6366f1, #8b5cf6);
    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: #6366f1;
    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;
}

/* ============================================
   使用里程碑慶祝彈窗
   ============================================ */
.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(99, 102, 241, 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;
}

/* ============================================
   人格養成解鎖慶祝
   ============================================ */
.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(139, 92, 246, 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, #8b5cf6, #6366f1);
    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: #6366f1;
    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, #8b5cf6, #6366f1);
    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;
}

/* ============================================
   每日一句推送 Toast
   ============================================ */
.daily-quote-toast {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%) translateY(-100px);
    background: linear-gradient(135deg, var(--primary-color), var(--primary-light));
    color: #fff;
    padding: 14px 24px;
    border-radius: 16px;
    box-shadow: 0 8px 30px rgba(99, 102, 241, 0.35);
    z-index: 9999;
    max-width: 400px;
    width: 90%;
    text-align: center;
    font-size: 15px;
    line-height: 1.5;
    opacity: 0;
    transition: transform 0.5s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.5s ease;
    pointer-events: none;
}

.daily-quote-toast.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
    pointer-events: auto;
}

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

.daily-quote-toast .quote-label {
    font-size: 11px;
    opacity: 0.8;
    margin-bottom: 4px;
}

/* ============================================
   AI 主動關懷訊息
   ============================================ */
.care-message {
    background: linear-gradient(135deg, #EEF2FF, #FDF2F8);
    border: 1px solid #E0E7FF;
    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 {
    font-size: 11px;
    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;
}

.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;
}
