/**
 * Pixel Gallery - User Profile Styles (profile.css)
 * Minimal Borderless Design System
 * - ไร้กรอบซ้อนทับ แบ่งสัดส่วนด้วยช่องว่างและพื้นผิวโปร่งแสง
 * - ใช้ไอคอนเส้น Lucide (stroke 1.75) แทนอีโมจิทั้งหมด
 * - รองรับทั้งโหมดสว่างและโหมดมืด (body.dark-mode, html.dark-mode, [data-theme="dark"])
 * - รองรับทั้งคอมพิวเตอร์ แท็บเล็ต และโทรศัพท์มือถือ
 */

/* ==========================================================================
   1. Theme Variables & Base Setup
   ========================================================================== */
:root {
    --pf-font: 'Kanit', 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;

    /* Light Mode */
    --pf-bg: #fafafa;
    --pf-surface: rgba(0, 0, 0, 0.035);
    --pf-surface-hover: rgba(0, 0, 0, 0.06);
    --pf-surface-strong: rgba(0, 0, 0, 0.08);
    --pf-glass: rgba(250, 250, 250, 0.84);
    --pf-sticky-header-bg: rgba(250, 250, 250, 0.96);
    --pf-card-glass: linear-gradient(145deg, rgba(255, 255, 255, 0.88) 0%, rgba(255, 255, 255, 0.74) 100%);
    --pf-hairline: rgba(0, 0, 0, 0.06);

    --pf-text-primary: #111827;
    --pf-text-secondary: #52525b;
    --pf-text-muted: #9ca3af;

    --pf-primary-bg: #111827;
    --pf-primary-fg: #ffffff;
    --pf-primary-hover: #27272a;

    --pf-accent: #2563eb;
    --pf-success: #059669;
    --pf-success-subtle: rgba(16, 185, 129, 0.1);
    --pf-warning: #d97706;
    --pf-warning-subtle: rgba(245, 158, 11, 0.12);
    --pf-danger: #dc2626;
    --pf-danger-subtle: rgba(239, 68, 68, 0.1);

    --pf-shadow-float: 0 20px 48px rgba(0, 0, 0, 0.12), 0 4px 14px rgba(0, 0, 0, 0.05);

    --pf-border: rgba(0, 0, 0, 0.09);
    --pf-modal-bg: #ffffff;
    --pf-modal-head-border: rgba(0, 0, 0, 0.06);
    --pf-modal-input-bg: #f4f4f5;
    --pf-modal-input-border: rgba(0, 0, 0, 0.12);
    --pf-modal-foot-bg: #f9fafb;
    --pf-modal-shadow: 0 24px 60px -10px rgba(0, 0, 0, 0.16), 0 0 0 1px rgba(0, 0, 0, 0.06);
}

body.dark-mode,
html.dark-mode,
[data-theme="dark"] {
    --pf-bg: #0c0c0e;
    --pf-surface: rgba(255, 255, 255, 0.05);
    --pf-surface-hover: rgba(255, 255, 255, 0.085);
    --pf-surface-strong: rgba(255, 255, 255, 0.12);
    --pf-glass: rgba(12, 12, 14, 0.82);
    --pf-sticky-header-bg: rgba(12, 12, 14, 0.95);
    --pf-card-glass: linear-gradient(145deg, rgba(39, 39, 42, 0.82) 0%, rgba(18, 18, 20, 0.88) 100%);
    --pf-hairline: rgba(255, 255, 255, 0.07);

    --pf-text-primary: #f4f4f5;
    --pf-text-secondary: #a1a1aa;
    --pf-text-muted: #71717a;

    --pf-primary-bg: #ffffff;
    --pf-primary-fg: #111827;
    --pf-primary-hover: #e4e4e7;

    --pf-accent: #60a5fa;
    --pf-success: #34d399;
    --pf-success-subtle: rgba(16, 185, 129, 0.16);
    --pf-warning: #fbbf24;
    --pf-warning-subtle: rgba(245, 158, 11, 0.16);
    --pf-danger: #f87171;
    --pf-danger-subtle: rgba(239, 68, 68, 0.16);

    --pf-shadow-float: 0 24px 56px rgba(0, 0, 0, 0.6), 0 4px 16px rgba(0, 0, 0, 0.35);

    --pf-border: rgba(255, 255, 255, 0.12);
    --pf-modal-bg: #18181b;
    --pf-modal-head-border: rgba(255, 255, 255, 0.08);
    --pf-modal-input-bg: rgba(255, 255, 255, 0.05);
    --pf-modal-input-border: rgba(255, 255, 255, 0.12);
    --pf-modal-foot-bg: rgba(0, 0, 0, 0.25);
    --pf-modal-shadow: 0 24px 60px -10px rgba(0, 0, 0, 0.7), 0 0 0 1px rgba(255, 255, 255, 0.1);
}

html:has(body.profile-page),
body.profile-page {
    overflow-x: clip;
    max-width: 100%;
}

body.profile-page {
    background-color: var(--pf-bg);
    color: var(--pf-text-primary);
    font-family: var(--pf-font);
    margin: 0;
    padding: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    transition: background-color 0.25s ease, color 0.25s ease;
    -webkit-font-smoothing: antialiased;
}

.pf-icon {
    display: inline-block;
    vertical-align: middle;
    flex-shrink: 0;
}

.pf-inline-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    vertical-align: -2px;
    margin: 0 2px;
    color: var(--pf-text-primary);
}

/* ==========================================================================
   2. Sticky Navbar Integration
   ========================================================================== */
body.profile-page .pg-navbar {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 70px;
    z-index: 9990;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 5%;
    box-sizing: border-box;
    font-family: var(--font-sans, 'Kanit', sans-serif);
    background-color: transparent;
    transition: background-color 0.3s ease, backdrop-filter 0.3s ease;
    user-select: none;
}

body.profile-page .pg-navbar.scrolled {
    background-color: var(--pf-glass);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
}

body.dark-mode.profile-page .pg-nav-logo,
body.profile-page[data-theme="dark"] .pg-nav-logo,
html.dark-mode body.profile-page .pg-nav-logo,
body.dark-mode.profile-page .pg-theme-btn,
body.profile-page[data-theme="dark"] .pg-theme-btn,
html.dark-mode body.profile-page .pg-theme-btn,
body.dark-mode.profile-page .pg-cart-btn,
body.profile-page[data-theme="dark"] .pg-cart-btn,
html.dark-mode body.profile-page .pg-cart-btn,
body.dark-mode.profile-page .pg-menu-toggle,
body.profile-page[data-theme="dark"] .pg-menu-toggle,
html.dark-mode body.profile-page .pg-menu-toggle {
    color: #f4f4f5;
}

/* ==========================================================================
   3. Container Layout & Shared Buttons
   ========================================================================== */
.profile-container {
    width: 100%;
    max-width: 1060px;
    margin: 0 auto;
    padding: clamp(92px, 8vw, 112px) 24px 108px;
    box-sizing: border-box;
    flex: 1;
}

.profile-pill-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    height: 40px;
    padding: 0 18px;
    border-radius: 9999px;
    border: none;
    background: var(--pf-surface);
    color: var(--pf-text-primary);
    font-family: inherit;
    font-size: 0.85rem;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    transition: background 0.18s ease, color 0.18s ease, transform 0.15s ease;
    white-space: nowrap;
    outline: none;
    box-sizing: border-box;
}

@media (hover: hover) and (pointer: fine) {
    .profile-pill-btn:hover {
        background: var(--pf-surface-hover);
    }
}

.profile-pill-btn:active {
    transform: scale(0.97);
}

.profile-pill-btn.primary {
    background: var(--pf-primary-bg);
    color: var(--pf-primary-fg);
}

@media (hover: hover) and (pointer: fine) {
    .profile-pill-btn.primary:hover {
        background: var(--pf-primary-hover);
    }
}

.profile-icon-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: none;
    background: var(--pf-surface);
    color: var(--pf-text-primary);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.18s ease, color 0.18s ease, transform 0.15s ease, opacity 0.18s ease;
    flex-shrink: 0;
    outline: none;
}

@media (hover: hover) and (pointer: fine) {
    .profile-icon-btn:hover:not(:disabled) {
        background: var(--pf-surface-hover);
    }
}

.profile-icon-btn:active:not(:disabled) {
    transform: scale(0.95);
}

.profile-icon-btn:disabled {
    opacity: 0.35;
    cursor: not-allowed;
}

.profile-icon-btn.danger {
    color: var(--pf-danger);
    background: var(--pf-danger-subtle);
}

@media (hover: hover) and (pointer: fine) {
    .profile-icon-btn.danger:hover:not(:disabled) {
        background: rgba(239, 68, 68, 0.2);
    }
}

.profile-btn-re-download.is-loading {
    pointer-events: none;
    opacity: 0.85;
    background: var(--pf-surface-hover);
}

.profile-btn-re-download.is-loading svg {
    animation: pfRotateSpin 0.85s linear infinite;
}

@keyframes pfRotateSpin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

.profile-text-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 36px;
    padding: 0 12px;
    border-radius: 9999px;
    border: none;
    background: transparent;
    color: var(--pf-text-secondary);
    font-family: inherit;
    font-size: 0.84rem;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.18s ease, color 0.18s ease;
    outline: none;
}

@media (hover: hover) and (pointer: fine) {
    .profile-text-btn:hover {
        background: var(--pf-surface);
        color: var(--pf-text-primary);
    }
}

.profile-meta-dot {
    width: 3px;
    height: 3px;
    border-radius: 50%;
    background: var(--pf-text-muted);
    display: inline-block;
    vertical-align: middle;
    flex-shrink: 0;
}

/* ==========================================================================
   4. Minimal Profile Header
   ========================================================================== */
.profile-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    padding: 4px 0 28px;
}

.profile-user-left {
    display: flex;
    align-items: center;
    gap: 18px;
    min-width: 0;
    flex: 1;
}

.profile-avatar-wrap {
    position: relative;
    width: 72px;
    height: 72px;
    flex-shrink: 0;
}

.profile-avatar-img,
.profile-avatar-fallback {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    object-fit: cover;
    display: block;
    background: var(--pf-surface-strong);
    border: none;
}

.profile-avatar-fallback {
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--pf-primary-bg);
    color: var(--pf-primary-fg);
    font-size: 1.5rem;
    font-weight: 600;
    text-transform: uppercase;
}

.profile-avatar-status {
    position: absolute;
    bottom: 2px;
    right: 2px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #10b981;
    box-shadow: 0 0 0 3px var(--pf-bg);
}

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

.profile-user-name {
    font-size: clamp(1.25rem, 2.4vw, 1.6rem);
    font-weight: 600;
    color: var(--pf-text-primary);
    margin: 0 0 4px;
    line-height: 1.25;
    letter-spacing: -0.02em;
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.profile-verified {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    line-height: 1;
    color: #1d9bf0;
}

.profile-group-tick {
    display: inline-flex;
    align-items: center;
    line-height: 1;
    margin-left: 1px;
}

.profile-user-meta {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    font-size: 0.84rem;
    color: var(--pf-text-secondary);
}

.profile-user-email {
    word-break: break-all;
}

.profile-user-badge-row {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 8px;
}

.profile-group-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 3px 10px;
    border-radius: 9999px;
    background: var(--pf-surface);
    color: var(--pf-text-secondary);
    font-size: 0.75rem;
    font-weight: 500;
    border: none;
}

.profile-group-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--pf-text-secondary);
    flex-shrink: 0;
}

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

/* ==========================================================================
   5. Underline Tabs Navigation Bar (Relaxes at top, floats as Liquid Capsule below)
   ========================================================================== */
.profile-tabs-bar {
    position: relative;
    top: auto;
    z-index: 2;
    width: 100vw;
    margin-left: calc(50% - 50vw);
    margin-right: calc(50% - 50vw);
    margin-top: 0;
    margin-bottom: 28px;
    padding: 0;
    background: transparent;
    border-bottom: 1px solid var(--pf-hairline);
    box-sizing: border-box;
}

body.pg-profile-tab-docked:not(.lightbox-open):not(.pg-floating-tabs-obscured) .pg-toast {
    bottom: calc(88px + env(safe-area-inset-bottom, 0px));
}

.profile-tabs-scroller {
    max-width: 1060px;
    margin: 0 auto;
    padding: 0 24px;
    box-sizing: border-box;
    display: flex;
    align-items: center;
    gap: 24px;
    overflow-x: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
    scroll-snap-type: x proximity;
}

.profile-tabs-scroller::-webkit-scrollbar {
    display: none;
}

.profile-tab-btn {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 14px 2px;
    background: transparent;
    border: none;
    color: var(--pf-text-secondary);
    font-family: inherit;
    font-size: 0.88rem;
    font-weight: 500;
    cursor: pointer;
    white-space: nowrap;
    transition: color 0.18s ease;
    scroll-snap-align: start;
    outline: none;
}

@media (hover: hover) and (pointer: fine) {
    .profile-tab-btn:hover {
        color: var(--pf-text-primary);
    }
}

.profile-tab-btn::after {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    bottom: -1px;
    height: 2px;
    border-radius: 9999px;
    background: var(--pf-text-primary);
    transform: scaleX(0);
    transition: transform 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}

.profile-tab-btn.active {
    color: var(--pf-text-primary);
    font-weight: 600;
}

.profile-tab-btn.active::after {
    transform: scaleX(1);
}

.profile-tab-label .pf-sm {
    display: none;
}

.profile-tab-count {
    font-size: 0.78rem;
    font-weight: 400;
    color: var(--pf-text-muted);
    font-variant-numeric: tabular-nums;
}

.profile-tab-btn.active .profile-tab-count {
    color: var(--pf-text-secondary);
}

.profile-tab-pane {
    display: none;
    animation: pfFadeIn 0.22s ease;
}

.profile-tab-pane.active {
    display: block;
}

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

/* ==========================================================================
   6. Tab 1: Favorites Gallery & Contextual Selection Bar
   ========================================================================== */
.profile-fav-toolbar {
    margin-bottom: 18px;
}

.profile-toolbar-default {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.profile-toolbar-title {
    font-size: 0.9rem;
    color: var(--pf-text-secondary);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.profile-toolbar-title strong {
    color: var(--pf-text-primary);
    font-weight: 600;
}

.profile-toolbar-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* ==========================================================================
   6.1 แถบเครื่องมือและแบนเนอร์ในแท็บ "รูปของฉัน" (My Photos Face Banner & Actions)
   ========================================================================== */
.pf-myphotos-toolbar {
    margin-bottom: 22px;
    width: 100%;
}

#tab-pane-my_photos .pf-face-banner {
    padding: 0;
    max-width: none;
    margin: 0 0 22px 0;
    width: 100%;
}

#tab-pane-my_photos .pg-face-banner-toolbar {
    display: flex;
    align-items: center;
    width: 100%;
}

#tab-pane-my_photos .pf-myphotos-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    width: 100%;
}

#tab-pane-my_photos .pf-myphotos-filter-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    min-width: 0;
}

.pf-album-picker-trigger {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    height: 38px;
    padding: 0 12px;
    border-radius: 12px;
    background: rgba(15, 23, 42, 0.05);
    border: 1px solid rgba(15, 23, 42, 0.06);
    color: var(--pf-text-primary);
    font-family: inherit;
    font-size: 0.8rem;
    font-weight: 500;
    max-width: 240px;
    cursor: pointer;
    transition: background-color 0.16s ease;
}

@media (hover: hover) and (pointer: fine) {
    .pf-album-picker-trigger:hover {
        background: rgba(15, 23, 42, 0.09);
    }
}

.pf-album-picker-trigger.is-filtered {
    background: rgba(37, 99, 235, 0.1);
    border-color: rgba(37, 99, 235, 0.28);
    color: var(--pf-accent);
    font-weight: 600;
}

.pf-album-picker-label {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
}

body.dark-mode .pf-album-picker-trigger,
html.dark-mode .pf-album-picker-trigger,
[data-theme="dark"] .pf-album-picker-trigger {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(255, 255, 255, 0.08);
    color: #e4e4e7;
}

@media (hover: hover) and (pointer: fine) {
    body.dark-mode .pf-album-picker-trigger:hover,
    html.dark-mode .pf-album-picker-trigger:hover,
    [data-theme="dark"] .pf-album-picker-trigger:hover {
        background: rgba(255, 255, 255, 0.11);
    }
}

#tab-pane-my_photos .pf-myphotos-btn-cluster {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
    margin-left: auto;
}

#tab-pane-my_photos .pf-myphotos-select-btn,
#tab-pane-my_photos .pf-myphotos-scan-btn {
    height: 38px;
    padding: 0 13px;
    font-size: 0.8rem;
    font-weight: 600;
    border-radius: 12px;
}

#tab-pane-my_photos .pf-myphotos-select-btn {
    background: var(--pf-primary-bg);
    color: var(--pf-primary-fg);
    border: 1px solid transparent;
    box-shadow: 0 4px 12px rgba(17, 24, 39, 0.14);
}

@media (hover: hover) and (pointer: fine) {
    #tab-pane-my_photos .pf-myphotos-select-btn:hover {
        background: var(--pf-primary-hover);
        color: var(--pf-primary-fg);
    }
}

body.dark-mode #tab-pane-my_photos .pf-myphotos-select-btn,
html.dark-mode #tab-pane-my_photos .pf-myphotos-select-btn,
[data-theme="dark"] #tab-pane-my_photos .pf-myphotos-select-btn {
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.35);
}

#tab-pane-my_photos .pf-myphotos-scan-btn {
    background: rgba(37, 99, 235, 0.10);
    color: #1d4ed8;
    border: 1px solid rgba(37, 99, 235, 0.22);
}

@media (hover: hover) and (pointer: fine) {
    #tab-pane-my_photos .pf-myphotos-scan-btn:hover {
        background: rgba(37, 99, 235, 0.16);
        border-color: rgba(37, 99, 235, 0.34);
        color: #1e40af;
    }
}

body.dark-mode #tab-pane-my_photos .pf-myphotos-scan-btn,
html.dark-mode #tab-pane-my_photos .pf-myphotos-scan-btn,
[data-theme="dark"] #tab-pane-my_photos .pf-myphotos-scan-btn {
    background: rgba(59, 130, 246, 0.16);
    color: #60a5fa;
    border-color: rgba(96, 165, 250, 0.28);
}

@media (hover: hover) and (pointer: fine) {
    body.dark-mode #tab-pane-my_photos .pf-myphotos-scan-btn:hover,
    html.dark-mode #tab-pane-my_photos .pf-myphotos-scan-btn:hover,
    [data-theme="dark"] #tab-pane-my_photos .pf-myphotos-scan-btn:hover {
        background: rgba(59, 130, 246, 0.24);
        border-color: rgba(96, 165, 250, 0.42);
        color: #93c5fd;
    }
}

#tab-pane-my_photos .pf-myphotos-del-btn {
    width: 38px;
    height: 38px;
    border-radius: 12px;
    border: none;
    outline: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    box-sizing: border-box;
}

/* จุดสถานะสีระบุความตรงกันบนการ์ดรูปภาพ (แทนการแสดงเปอร์เซ็นต์ตัวเลข) */
.pg-card-face-dot-badge {
    position: absolute;
    top: 10px;
    left: 10px;
    z-index: 3;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: rgba(15, 23, 42, 0.78);
    pointer-events: none;
    transition: top 0.2s ease, left 0.2s ease;
}

.pg-card-face-dot-badge .pg-card-face-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #10b981;
    box-shadow: 0 0 6px rgba(16, 185, 129, 0.8);
    flex-shrink: 0;
}

.pg-card-face-dot-badge.weak .pg-card-face-dot {
    background: #f59e0b;
    box-shadow: 0 0 6px rgba(245, 158, 11, 0.8);
}

/* บนเดสก์ท็อป: เมื่อ hover หรืออยู่ในโหมดเลือกรูป ให้เลื่อนจุดสีหลบไปที่ left: 42px เพื่อไม่ให้ทับกับ Checkbox */
.profile-fav-card.selected .pg-card-face-dot-badge,
#tab-pane-my_photos.is-selecting .pg-card-face-dot-badge {
    left: 42px;
}

@media (hover: hover) and (pointer: fine) {
    .profile-fav-card:hover .pg-card-face-dot-badge {
        left: 42px;
    }
}

.pf-myphotos-selbar-custom {
    display: none;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 8px 16px;
    border-radius: 9999px;
    background: var(--pf-surface);
    border: none;
    outline: none;
    box-sizing: border-box;
    width: 100%;
}

.pf-myphotos-toolbar.is-selecting .pf-myphotos-selbar-custom,
.profile-fav-toolbar.is-selecting .profile-selbar {
    display: flex !important;
}

.pf-myphotos-toolbar.is-selecting #pf-myphotos-toolbar-default,
.profile-fav-toolbar.is-selecting .profile-toolbar-default {
    display: none !important;
}

/* Tablet & Mobile Screens (<= 768px) */
@media (max-width: 768px) {
    .pf-myphotos-toolbar {
        margin-bottom: 16px;
    }

    #tab-pane-my_photos .pg-face-banner-toolbar {
        width: 100%;
    }

    #tab-pane-my_photos .pf-myphotos-actions {
        width: 100%;
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
        margin-left: 0;
    }

    #tab-pane-my_photos .pf-myphotos-filter-bar {
        width: 100%;
    }

    #tab-pane-my_photos .pf-album-picker-trigger {
        width: 100%;
        max-width: none;
        height: 40px;
        justify-content: space-between;
    }

    /* ลดปุ่มซ้อนบนการ์ดมือถือในแท็บ "รูปของฉัน" (คงเฉพาะปุ่มตะกร้า + จุดสถานะ; หัวใจ/ดาวน์โหลดกดดูได้ใน Lightbox) */
    #tab-pane-my_photos .js-myphoto-fav,
    #tab-pane-my_photos .js-myphoto-open-album {
        display: none;
    }

    #tab-pane-my_photos .profile-fav-overlay {
        background: none;
        padding: 8px;
    }

    #tab-pane-my_photos .pf-myphotos-btn-cluster {
        display: grid;
        grid-template-columns: 1fr 1fr 40px;
        gap: 8px;
        width: 100%;
        margin-left: 0;
    }

    #tab-pane-my_photos .pf-myphotos-btn-cluster .pg-face-btn {
        width: 100%;
        height: 40px;
        padding: 0 10px;
        justify-content: center;
    }

    #tab-pane-my_photos .pf-myphotos-del-btn {
        width: 40px;
        height: 40px;
        border-radius: 12px;
    }

    /* ในโทรศัพท์เมื่อกดเลือกรูป ให้ย้ายจุดลงมาด้านล่างของวงกลมเลือก (top: 42px, left: 12px) แทนการไปทางขวา เพื่อไม่ให้ทับปุ่มตะกร้า */
    @media (hover: hover) and (pointer: fine) {
        #tab-pane-my_photos .profile-fav-card:hover .pg-card-face-dot-badge {
            left: 10px;
            top: 10px;
        }
    }

    #tab-pane-my_photos.is-selecting .pg-card-face-dot-badge,
    #tab-pane-my_photos .profile-fav-card.selected .pg-card-face-dot-badge {
        top: 42px !important;
        left: 12px !important;
    }

    @media (hover: hover) and (pointer: fine) {
        #tab-pane-my_photos.is-selecting .profile-fav-card:hover .pg-card-face-dot-badge {
            top: 42px !important;
            left: 12px !important;
        }
    }

    /* Fixed bottom selection bar on mobile */
    .pf-myphotos-toolbar.is-selecting .pf-myphotos-selbar-custom,
    .pf-myphotos-toolbar.is-selecting .profile-selbar {
        position: fixed;
        bottom: calc(16px + env(safe-area-inset-bottom, 0px));
        left: 16px;
        right: 16px;
        width: auto;
        z-index: 95;
        background: var(--pf-modal-bg, rgba(24, 24, 27, 0.94));
        backdrop-filter: blur(24px) saturate(180%);
        -webkit-backdrop-filter: blur(24px) saturate(180%);
        box-shadow: 0 12px 36px rgba(0, 0, 0, 0.28);
        border: none;
        outline: none;
        padding: 10px 18px;
    }

    #tab-pane-my_photos.is-selecting {
        padding-bottom: 72px;
    }
}

.profile-selbar {
    display: none;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 8px 14px;
    border-radius: 9999px;
    background: var(--pf-surface);
}

.profile-fav-toolbar.is-selecting .profile-toolbar-default {
    display: none !important;
}

.profile-fav-toolbar.is-selecting .profile-selbar {
    display: flex !important;
}

.profile-check-all-label {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-size: 0.85rem;
    color: var(--pf-text-primary);
    cursor: pointer;
    user-select: none;
}

.profile-check-all-label input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.profile-check-ui {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: var(--pf-surface-strong);
    color: transparent;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background 0.18s ease, color 0.18s ease, transform 0.15s ease;
    flex-shrink: 0;
}

.profile-check-all-label input:checked + .profile-check-ui,
.profile-fav-check input:checked + .profile-check-ui {
    background: var(--pf-primary-bg);
    color: var(--pf-primary-fg);
}

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

.profile-fav-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 14px;
}

.profile-fav-card {
    position: relative;
    border-radius: 16px;
    overflow: hidden;
    background: var(--pf-surface);
    aspect-ratio: 1 / 1;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
    cursor: pointer;
    contain: layout paint style;
    content-visibility: auto;
    contain-intrinsic-size: 240px;
}

#tab-pane-favorites.is-selecting .profile-fav-card,
#tab-pane-my_photos.is-selecting .profile-fav-card {
    cursor: pointer;
}

.profile-fav-thumb-box {
    width: 100%;
    height: 100%;
    position: relative;
    overflow: hidden;
    border-radius: 16px;
    background-color: var(--pf-surface);
}

.profile-fav-thumb-box img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    opacity: 0;
    color: transparent;
    font-size: 0;
    border-radius: 16px;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
    -webkit-user-drag: none;
    transition: opacity 0.22s ease, transform 0.28s cubic-bezier(0.16, 1, 0.3, 1), border-radius 0.22s ease;
}

.profile-fav-thumb-box.is-loaded img {
    opacity: 1;
}

@media (hover: hover) and (pointer: fine) {
    .profile-fav-card:hover .profile-fav-thumb-box img {
        transform: scale(1.03);
    }
}

.profile-fav-card.is-longpressing .profile-fav-thumb-box img {
    transform: scale(0.95);
    border-radius: 14px;
}

.profile-fav-card.selected .profile-fav-thumb-box img {
    transform: scale(0.94);
    border-radius: 12px;
}

/* ปุ่มติ๊กเลือกรูปทรงกลมกระจกมุมซ้ายบน */
.profile-fav-check {
    position: absolute;
    top: 10px;
    left: 10px;
    z-index: 4;
    cursor: pointer;
    opacity: 0;
    transform: scale(0.9);
    transition: opacity 0.18s ease, transform 0.18s ease;
}

.profile-fav-check input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.profile-fav-check .profile-check-ui {
    width: 26px;
    height: 26px;
    background: rgba(24, 24, 27, 0.72);
    color: transparent;
}

.profile-fav-check input:checked + .profile-check-ui {
    background: #ffffff;
    color: #111827;
}

.profile-fav-card.selected .profile-fav-check,
#tab-pane-favorites.is-selecting .profile-fav-check,
#tab-pane-my_photos.is-selecting .profile-fav-check {
    opacity: 1;
    transform: scale(1);
    pointer-events: auto;
}

@media (hover: hover) and (pointer: fine) {
    .profile-fav-card:hover .profile-fav-check {
        opacity: 1;
        transform: scale(1);
        pointer-events: auto;
    }
}

#tab-pane-favorites.is-selecting .profile-fav-overlay,
#tab-pane-my_photos.is-selecting .profile-fav-overlay {
    pointer-events: none;
}

#tab-pane-my_photos.is-selecting .pg-card-yes-me-btn,
#tab-pane-my_photos.is-selecting .pg-card-not-me-btn {
    opacity: 0 !important;
    pointer-events: none !important;
}

/* เลเยอร์ปุ่มลัดบนมุมขวาบนของรูป */
.profile-fav-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(0, 0, 0, 0.28) 0%, transparent 45%);
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    padding: 10px;
    opacity: 0;
    transition: opacity 0.2s ease;
    z-index: 2;
}

@media (hover: hover) and (pointer: fine) {
    .profile-fav-card:hover .profile-fav-overlay {
        opacity: 1;
    }

    .profile-fav-quick-btn:hover {
        background: rgba(24, 24, 27, 0.88);
        transform: scale(1.06);
    }
}

@media (hover: none), (pointer: coarse) {
    .profile-fav-overlay {
        opacity: 1;
        background: linear-gradient(180deg, rgba(0, 0, 0, 0.24) 0%, transparent 40%);
    }

    #tab-pane-my_photos .profile-fav-overlay {
        background: none;
        padding: 8px;
    }
}

.profile-fav-card.is-longpressing .profile-fav-overlay,
.profile-fav-card.selected .profile-fav-overlay {
    opacity: 0;
    pointer-events: none;
}

.profile-fav-quick {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 6px;
}

.profile-fav-quick-btn {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: none;
    background: rgba(24, 24, 27, 0.72);
    color: #ffffff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    text-decoration: none;
    transition: background-color 0.16s ease, transform 0.14s ease;
}

.profile-fav-quick-btn.in-cart {
    background: #10b981;
    color: #ffffff;
}

.profile-fav-quick-btn.is-fav {
    background: rgba(239, 68, 68, 0.92);
    color: #ffffff;
}

.profile-fav-quick-btn.is-fav svg {
    fill: currentColor;
}

.profile-hero-cart-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 19px;
    height: 19px;
    padding: 0 6px;
    border-radius: 9999px;
    background: rgba(255, 255, 255, 0.2);
    color: inherit;
    font-size: 0.72rem;
    font-weight: 600;
    line-height: 1;
}

body.dark-mode .profile-hero-cart-count,
html.dark-mode .profile-hero-cart-count,
[data-theme="dark"] .profile-hero-cart-count {
    background: rgba(0, 0, 0, 0.16);
}

.profile-fav-quick-btn.del {
    color: #f87171;
}

.profile-fav-quick-btn.del svg {
    fill: currentColor;
}

.profile-fav-card-meta {
    min-width: 0;
    color: #ffffff;
}

.profile-fav-card-name {
    font-size: 0.78rem;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.profile-fav-card-album {
    font-size: 0.7rem;
    color: rgba(255, 255, 255, 0.75);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ==========================================================================
   7. Tab 2: Download History (Grouped List)
   ========================================================================== */
.profile-filter-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.profile-select-wrap {
    position: relative;
}

.profile-filter-select {
    appearance: none;
    -webkit-appearance: none;
    height: 38px;
    padding: 0 34px 0 14px;
    border-radius: 9999px;
    border: none;
    background-color: var(--pf-surface);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%2371717a' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    color: var(--pf-text-primary);
    font-family: inherit;
    font-size: 0.84rem;
    font-weight: 500;
    cursor: pointer;
    outline: none;
    transition: background-color 0.18s ease;
}

@media (hover: hover) and (pointer: fine) {
    .profile-filter-select:hover {
        background-color: var(--pf-surface-hover);
    }
}

/* Inline Horizontal History Filters (2 Pill Selects + Reset) */
.pf-hist-filter-row {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: nowrap;
    margin-bottom: 18px;
}

.pf-hist-select-wrap {
    position: relative;
    display: inline-flex;
    align-items: center;
    min-width: 0;
}

.pf-hist-album-wrap {
    max-width: 240px;
}

.pf-hist-select-icon {
    position: absolute;
    left: 13px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 2;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--pf-text-muted);
    pointer-events: none;
    transition: color 0.18s ease;
}

.pf-hist-select {
    width: 100%;
    min-width: 0;
    height: 41px;
    padding: 0 32px 0 36px;
    border-radius: 14px;
    font-size: 0.87rem;
    font-weight: 500;
    text-overflow: ellipsis;
    box-sizing: border-box;
    transition: background-color 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
}

.pf-hist-select option {
    background-color: #ffffff;
    color: #111827;
}

.pf-hist-select-wrap.is-active .pf-hist-select {
    background-color: rgba(0, 0, 0, 0.075);
    color: #111827;
    font-weight: 600;
}

.pf-hist-select-wrap.is-active .pf-hist-select-icon {
    color: #111827;
}

.pf-hist-select-wrap.is-custom.is-open {
    z-index: 45;
}

.pf-hist-native-select-hidden {
    position: absolute !important;
    opacity: 0 !important;
    pointer-events: none !important;
    width: 1px !important;
    height: 1px !important;
    margin: 0 !important;
    padding: 0 !important;
    overflow: hidden !important;
}

.pf-hist-select-wrap .pg-cselect-trigger {
    width: 100%;
    min-width: 0;
    height: 41px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 0 13px 0 36px;
    border-radius: 14px;
    border: none;
    background-color: rgba(0, 0, 0, 0.045);
    color: #111827;
    font-family: inherit;
    font-size: 0.87rem;
    font-weight: 500;
    cursor: pointer;
    text-align: left;
    outline: none;
    box-sizing: border-box;
    transition: background-color 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
}

@media (hover: hover) and (pointer: fine) {
    .pf-hist-select-wrap .pg-cselect-trigger:hover {
        background-color: rgba(0, 0, 0, 0.075);
    }
}

.pf-hist-select-wrap .pg-cselect-trigger:focus-visible,
.pf-hist-select-wrap.is-open .pg-cselect-trigger {
    background-color: rgba(0, 0, 0, 0.08);
    box-shadow: 0 0 0 2px rgba(17, 24, 39, 0.14);
}

.pf-hist-select-wrap.is-active .pg-cselect-trigger {
    background-color: rgba(0, 0, 0, 0.075);
    color: #111827;
    font-weight: 600;
}

.pf-hist-select-wrap.is-active.is-open .pg-cselect-trigger {
    background-color: rgba(0, 0, 0, 0.08);
    box-shadow: 0 0 0 2px rgba(17, 24, 39, 0.14);
}

.pf-hist-select-wrap .pg-cselect-label {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.pf-hist-select-wrap .pg-cselect-chevron {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
    color: #4b5563;
    transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.pf-hist-select-wrap.is-open .pg-cselect-chevron {
    transform: rotate(180deg);
}

.pf-hist-select-wrap .pg-cselect-menu {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    min-width: max(100%, 210px);
    max-width: min(320px, 82vw);
    max-height: 230px;
    overflow-y: auto;
    background: #ffffff;
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 14px;
    padding: 5px;
    box-shadow: 0 16px 38px -8px rgba(0, 0, 0, 0.16), 0 4px 12px rgba(0, 0, 0, 0.06);
    z-index: 95;
    box-sizing: border-box;
    opacity: 0;
    transform: translateY(-4px) scale(0.98);
    transform-origin: top center;
    transition: opacity 0.15s ease, transform 0.18s cubic-bezier(0.16, 1, 0.3, 1);
}

.pf-hist-select-wrap .pg-cselect-menu.open {
    opacity: 1;
    transform: translateY(0) scale(1);
}

.pf-hist-select-wrap .pg-cselect-menu[hidden] {
    display: none;
}

.pf-hist-select-wrap .pg-cselect-option {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 8px 10px;
    border: none;
    border-radius: 10px;
    background: transparent;
    color: #1f2937;
    font-family: inherit;
    font-size: 0.84rem;
    font-weight: 500;
    text-align: left;
    cursor: pointer;
    box-sizing: border-box;
    transition: background-color 0.15s ease, color 0.15s ease;
}

@media (hover: hover) and (pointer: fine) {
    .pf-hist-select-wrap .pg-cselect-option:hover {
        background: rgba(0, 0, 0, 0.05);
        color: #111827;
    }
}

.pf-hist-select-wrap .pg-cselect-option.is-selected {
    background: #111827;
    color: #ffffff;
    font-weight: 600;
}

.pf-hist-select-wrap .pg-cselect-option svg {
    width: 13px;
    height: 13px;
    flex-shrink: 0;
}

body.dark-mode .pf-hist-select-wrap .pg-cselect-trigger,
html.dark-mode .pf-hist-select-wrap .pg-cselect-trigger,
[data-theme="dark"] .pf-hist-select-wrap .pg-cselect-trigger {
    background-color: rgba(255, 255, 255, 0.07);
    color: #f4f4f5;
}

@media (hover: hover) and (pointer: fine) {
    body.dark-mode .pf-hist-select-wrap .pg-cselect-trigger:hover,
    html.dark-mode .pf-hist-select-wrap .pg-cselect-trigger:hover,
    [data-theme="dark"] .pf-hist-select-wrap .pg-cselect-trigger:hover {
        background-color: rgba(255, 255, 255, 0.11);
    }
}

body.dark-mode .pf-hist-select-wrap .pg-cselect-trigger:focus-visible,
body.dark-mode .pf-hist-select-wrap.is-open .pg-cselect-trigger,
html.dark-mode .pf-hist-select-wrap .pg-cselect-trigger:focus-visible,
html.dark-mode .pf-hist-select-wrap.is-open .pg-cselect-trigger,
[data-theme="dark"] .pf-hist-select-wrap .pg-cselect-trigger:focus-visible,
[data-theme="dark"] .pf-hist-select-wrap.is-open .pg-cselect-trigger {
    background-color: rgba(255, 255, 255, 0.12);
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.22);
}

body.dark-mode .pf-hist-select-wrap.is-active .pg-cselect-trigger,
html.dark-mode .pf-hist-select-wrap.is-active .pg-cselect-trigger,
[data-theme="dark"] .pf-hist-select-wrap.is-active .pg-cselect-trigger {
    background-color: rgba(255, 255, 255, 0.11);
    color: #ffffff;
}

body.dark-mode .pf-hist-select-wrap.is-active.is-open .pg-cselect-trigger,
html.dark-mode .pf-hist-select-wrap.is-active.is-open .pg-cselect-trigger,
[data-theme="dark"] .pf-hist-select-wrap.is-active.is-open .pg-cselect-trigger {
    background-color: rgba(255, 255, 255, 0.12);
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.22);
}

body.dark-mode .pf-hist-select-wrap .pg-cselect-chevron,
html.dark-mode .pf-hist-select-wrap .pg-cselect-chevron,
[data-theme="dark"] .pf-hist-select-wrap .pg-cselect-chevron {
    color: #a1a1aa;
}

body.dark-mode .pf-hist-select-wrap .pg-cselect-menu,
html.dark-mode .pf-hist-select-wrap .pg-cselect-menu,
[data-theme="dark"] .pf-hist-select-wrap .pg-cselect-menu {
    background: #18181b;
    border-color: rgba(255, 255, 255, 0.12);
    box-shadow: 0 18px 42px rgba(0, 0, 0, 0.65), 0 4px 12px rgba(0, 0, 0, 0.4);
}

body.dark-mode .pf-hist-select-wrap .pg-cselect-option,
html.dark-mode .pf-hist-select-wrap .pg-cselect-option,
[data-theme="dark"] .pf-hist-select-wrap .pg-cselect-option {
    color: #e4e4e7;
}

@media (hover: hover) and (pointer: fine) {
    body.dark-mode .pf-hist-select-wrap .pg-cselect-option:hover,
    html.dark-mode .pf-hist-select-wrap .pg-cselect-option:hover,
    [data-theme="dark"] .pf-hist-select-wrap .pg-cselect-option:hover {
        background: rgba(255, 255, 255, 0.08);
        color: #ffffff;
    }
}

body.dark-mode .pf-hist-select-wrap .pg-cselect-option.is-selected,
html.dark-mode .pf-hist-select-wrap .pg-cselect-option.is-selected,
[data-theme="dark"] .pf-hist-select-wrap .pg-cselect-option.is-selected {
    background: #ffffff;
    color: #111111;
}

.pf-hist-reset-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    height: 41px;
    padding: 0 14px;
    border-radius: 14px;
    border: none;
    outline: none;
    background: var(--pf-surface);
    color: var(--pf-text-muted);
    font-family: inherit;
    font-size: 0.82rem;
    font-weight: 500;
    cursor: pointer;
    flex-shrink: 0;
    transition: background-color 0.18s ease, color 0.18s ease, transform 0.15s ease;
}

@media (hover: hover) and (pointer: fine) {
    .pf-hist-reset-btn:hover {
        background: rgba(239, 68, 68, 0.1);
        color: #dc2626;
    }
}

.pf-hist-reset-btn:active {
    transform: scale(0.95);
}

body.dark-mode .pf-hist-select option,
html.dark-mode .pf-hist-select option,
[data-theme="dark"] .pf-hist-select option {
    background-color: #18181b;
    color: #f4f4f5;
}

body.dark-mode .pf-hist-select-wrap.is-active .pf-hist-select,
html.dark-mode .pf-hist-select-wrap.is-active .pf-hist-select,
[data-theme="dark"] .pf-hist-select-wrap.is-active .pf-hist-select {
    background-color: rgba(255, 255, 255, 0.11);
    color: #ffffff;
}

body.dark-mode .pf-hist-select-wrap.is-active .pf-hist-select-icon,
html.dark-mode .pf-hist-select-wrap.is-active .pf-hist-select-icon,
[data-theme="dark"] .pf-hist-select-wrap.is-active .pf-hist-select-icon {
    color: #ffffff;
}

@media (hover: hover) and (pointer: fine) {
    body.dark-mode .pf-hist-reset-btn:hover,
    html.dark-mode .pf-hist-reset-btn:hover,
    [data-theme="dark"] .pf-hist-reset-btn:hover {
        background: rgba(248, 113, 113, 0.18);
        color: #fca5a5;
    }
}

@media (max-width: 640px) {
    .pf-hist-filter-row {
        gap: 8px;
        margin-bottom: 16px;
    }
    .pf-hist-select-wrap {
        flex: 1 1 0;
        min-width: 0;
        max-width: none;
    }
    .pf-hist-select {
        padding: 0 26px 0 32px;
        font-size: 0.81rem;
        background-position: right 10px center;
    }
    .pf-hist-select-icon {
        left: 11px;
    }
    .pf-hist-method-wrap .pg-cselect-menu {
        left: auto;
        right: 0;
        transform-origin: top right;
    }
    .pf-hist-reset-btn {
        width: 41px;
        padding: 0;
    }
    .pf-hist-reset-text {
        display: none;
    }
}

.profile-history-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.profile-hist-group {
    display: flex;
    flex-direction: column;
}

.profile-hist-day-btn {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 14px;
    border-radius: 14px;
    border: none;
    background: var(--pf-surface);
    color: var(--pf-text-primary);
    font-family: inherit;
    cursor: pointer;
    text-align: left;
    transition: background-color 0.18s ease;
}

@media (hover: hover) and (pointer: fine) {
    .profile-hist-day-btn:hover {
        background: var(--pf-surface-hover);
    }
}

.profile-hist-day-left {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}

.profile-hist-day-title {
    font-size: 0.86rem;
    font-weight: 600;
    color: var(--pf-text-primary);
}

.profile-hist-day-count {
    font-size: 0.74rem;
    font-weight: 500;
    color: var(--pf-text-secondary);
    padding: 2px 9px;
    border-radius: 9999px;
    background: var(--pf-surface-hover);
}

.profile-hist-day-chevron {
    display: inline-flex;
    align-items: center;
    color: var(--pf-text-muted);
    transition: transform 0.24s cubic-bezier(0.16, 1, 0.3, 1);
    flex-shrink: 0;
}

.profile-hist-group.is-open .profile-hist-day-chevron {
    transform: rotate(180deg);
}

.profile-hist-panel {
    display: none;
    overflow: hidden;
    contain: layout style;
}

.profile-hist-group.is-open > .profile-hist-panel,
.profile-hist-group.is-animating > .profile-hist-panel {
    display: block;
}

.profile-hist-group.is-open:not(.is-animating) > .profile-hist-panel {
    overflow: visible;
}

.profile-hist-panel-inner {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding-top: 6px;
    transform: translate3d(0, 0, 0);
    opacity: 1;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
}

.profile-hist-group.is-animating > .profile-hist-panel > .profile-hist-panel-inner {
    will-change: transform, opacity;
}

.profile-history-row {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 10px 12px;
    border-radius: 16px;
    background: transparent;
    contain: layout style paint;
    content-visibility: auto;
    contain-intrinsic-size: auto 68px;
    transition: background-color 0.16s ease;
}

@media (hover: hover) and (pointer: fine) {
    .profile-history-row:hover {
        background: var(--pf-surface);
    }
}

.profile-hist-thumb {
    width: 48px;
    height: 48px;
    border-radius: 10px;
    object-fit: cover;
    background: var(--pf-surface);
    flex-shrink: 0;
}

.profile-hist-main {
    min-width: 0;
    flex: 1;
}

.profile-hist-name {
    font-size: 0.88rem;
    font-weight: 500;
    color: var(--pf-text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 2px;
}

.profile-hist-sub {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
    font-size: 0.76rem;
    color: var(--pf-text-secondary);
}

.profile-hist-album {
    max-width: 260px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.profile-hist-empty {
    text-align: center;
    padding: 48px 20px;
    color: var(--pf-text-muted);
    font-size: 0.88rem;
}

/* ==========================================================================
   8. Tab 3: Accessible Albums (Borderless Cards)
   ========================================================================== */
.profile-albums-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 22px 18px;
}

.profile-album-card {
    display: flex;
    flex-direction: column;
    gap: 10px;
    text-decoration: none;
    color: inherit;
}

.profile-album-cover-box {
    position: relative;
    aspect-ratio: 4 / 3;
    border-radius: 18px;
    overflow: hidden;
    background: var(--pf-surface);
}

.profile-album-cover-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

@media (hover: hover) and (pointer: fine) {
    .profile-album-card:hover .profile-album-cover-img {
        transform: scale(1.04);
    }
}

.profile-album-cover-empty {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--pf-text-muted);
}

.profile-album-vis-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 10px;
    border-radius: 9999px;
    background: rgba(24, 24, 27, 0.62);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    color: #ffffff;
    font-size: 0.72rem;
    font-weight: 500;
}

.profile-album-content {
    padding: 0 2px;
}

.profile-album-title {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--pf-text-primary);
    margin: 0 0 3px;
    line-height: 1.35;
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.profile-album-meta {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
    font-size: 0.76rem;
    color: var(--pf-text-secondary);
}

.profile-album-date {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

/* ==========================================================================
   9. Tab 4: Hide Requests (Responsive Timeline Status + Soft Delete Trash)
   ========================================================================== */
.profile-req-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px 14px;
    flex-wrap: wrap;
    margin-bottom: 12px;
}

.profile-req-summary {
    font-size: 0.85rem;
    color: var(--pf-text-secondary);
}

.profile-req-summary strong {
    color: var(--pf-text-primary);
    font-weight: 600;
}

.profile-req-tools {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.profile-req-tool-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 34px;
    padding: 0 13px;
    border-radius: 9999px;
    border: none;
    background: var(--pf-surface);
    color: var(--pf-text-secondary);
    font-family: inherit;
    font-size: 0.78rem;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.2s cubic-bezier(0.32, 0.72, 0, 1), color 0.2s cubic-bezier(0.32, 0.72, 0, 1), transform 0.16s cubic-bezier(0.32, 0.72, 0, 1);
    -webkit-tap-highlight-color: transparent;
}

.profile-req-tool-btn[hidden] {
    display: none;
}

.profile-req-tool-btn .pf-icon {
    transition: transform 0.22s cubic-bezier(0.32, 0.72, 0, 1);
}

.profile-req-tool-btn:active {
    transform: scale(0.95);
}

.profile-req-tool-btn.is-popping .pf-icon {
    animation: pfTrashIconTap 0.36s cubic-bezier(0.22, 1.28, 0.36, 1) backwards;
}

@keyframes pfTrashIconTap {
    0%   { transform: translate3d(0, 0, 0) scale(1) rotate(0deg); }
    35%  { transform: translate3d(0, -1.5px, 0) scale(1.18) rotate(-13deg); }
    72%  { transform: translate3d(0, 0.5px, 0) scale(0.95) rotate(5deg); }
    100% { transform: translate3d(0, 0, 0) scale(1) rotate(0deg); }
}

.profile-req-tool-btn.is-entering-btn {
    animation: pfToolBtnIn 0.22s cubic-bezier(0.16, 1, 0.3, 1) backwards;
}

@keyframes pfToolBtnIn {
    from { opacity: 0; transform: translate3d(6px, 0, 0) scale(0.92); }
    to   { opacity: 1; transform: translate3d(0, 0, 0) scale(1); }
}

.profile-req-tool-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 19px;
    height: 19px;
    padding: 0 5px;
    border-radius: 9999px;
    background: var(--pf-surface-strong);
    color: var(--pf-text-primary);
    font-size: 0.7rem;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    transition: background-color 0.2s cubic-bezier(0.32, 0.72, 0, 1), color 0.2s cubic-bezier(0.32, 0.72, 0, 1);
}

.profile-req-tool-badge.is-bumping {
    animation: pfTrashBadgeBump 0.34s cubic-bezier(0.22, 1.28, 0.36, 1) backwards;
}

@keyframes pfTrashBadgeBump {
    0%   { transform: scale(1); }
    40%  { transform: scale(1.24); }
    100% { transform: scale(1); }
}

.profile-req-summary.is-swapping {
    animation: pfSummaryFade 0.2s cubic-bezier(0.16, 1, 0.3, 1) backwards;
}

@keyframes pfSummaryFade {
    from { opacity: 0.35; transform: translate3d(0, 3px, 0); }
    to   { opacity: 1; transform: translate3d(0, 0, 0); }
}

.profile-req-tool-btn.is-active {
    background: var(--pf-primary-bg);
    color: var(--pf-primary-fg);
}

.profile-req-tool-btn.is-active .profile-req-tool-badge {
    background: rgba(255, 255, 255, 0.22);
    color: var(--pf-primary-fg);
}

body.dark-mode .profile-req-tool-btn.is-active .profile-req-tool-badge,
html.dark-mode .profile-req-tool-btn.is-active .profile-req-tool-badge,
[data-theme="dark"] .profile-req-tool-btn.is-active .profile-req-tool-badge {
    background: rgba(17, 24, 39, 0.16);
    color: var(--pf-primary-fg);
}

@media (hover: hover) and (pointer: fine) {
    .profile-req-tool-btn:not(.is-active):hover {
        background: var(--pf-surface-hover);
        color: var(--pf-text-primary);
    }
}

#tab-pane-requests {
    overflow-x: clip;
    contain: layout style;
}

.profile-req-trash-banner {
    display: flex;
    align-items: flex-start;
    gap: 9px;
    padding: 10px 14px;
    margin-bottom: 12px;
    border-radius: 14px;
    background: rgba(37, 99, 235, 0.08);
    color: var(--pf-accent);
    font-size: 0.79rem;
    line-height: 1.48;
    transition: opacity 0.14s cubic-bezier(0.32, 0.72, 0, 1), transform 0.14s cubic-bezier(0.32, 0.72, 0, 1);
}

.profile-req-trash-banner[hidden] {
    display: none;
}

.profile-req-trash-banner.is-entering {
    animation: pfReqBannerIn 0.24s cubic-bezier(0.16, 1, 0.3, 1) backwards;
}

.profile-req-trash-banner.is-leaving {
    opacity: 0;
    transform: translate3d(0, -6px, 0);
    pointer-events: none;
}

@keyframes pfReqBannerIn {
    from { opacity: 0; transform: translate3d(0, -8px, 0) scale(0.988); }
    to   { opacity: 1; transform: translate3d(0, 0, 0) scale(1); }
}

.profile-req-trash-banner .pf-icon {
    flex-shrink: 0;
    margin-top: 2px;
}

body.dark-mode .profile-req-trash-banner,
html.dark-mode .profile-req-trash-banner,
[data-theme="dark"] .profile-req-trash-banner {
    background: rgba(96, 165, 250, 0.12);
}

.profile-requests-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    contain: layout style;
    transition: opacity 0.14s cubic-bezier(0.32, 0.72, 0, 1), transform 0.14s cubic-bezier(0.32, 0.72, 0, 1);
}

.profile-requests-list.is-leaving-to-trash {
    opacity: 0;
    transform: translate3d(-12px, 0, 0);
    pointer-events: none;
}

.profile-requests-list.is-leaving-to-main {
    opacity: 0;
    transform: translate3d(12px, 0, 0);
    pointer-events: none;
}

.profile-requests-list.is-entering-from-right > .profile-req-card,
.profile-requests-list.is-entering-from-right > .profile-empty-state,
.profile-requests-list.is-entering-from-right > .pf-req-skeleton {
    animation: pfReqInRight 0.26s cubic-bezier(0.16, 1, 0.3, 1) backwards;
}

.profile-requests-list.is-entering-from-left > .profile-req-card,
.profile-requests-list.is-entering-from-left > .profile-empty-state,
.profile-requests-list.is-entering-from-left > .pf-req-skeleton {
    animation: pfReqInLeft 0.26s cubic-bezier(0.16, 1, 0.3, 1) backwards;
}

.profile-requests-list.is-entering-from-right > :nth-child(2),
.profile-requests-list.is-entering-from-left > :nth-child(2) { animation-delay: 0.032s; }
.profile-requests-list.is-entering-from-right > :nth-child(3),
.profile-requests-list.is-entering-from-left > :nth-child(3) { animation-delay: 0.064s; }
.profile-requests-list.is-entering-from-right > :nth-child(n+4),
.profile-requests-list.is-entering-from-left > :nth-child(n+4) { animation-delay: 0.092s; }

@keyframes pfReqInRight {
    from { opacity: 0; transform: translate3d(14px, 0, 0) scale(0.992); }
    to   { opacity: 1; transform: translate3d(0, 0, 0) scale(1); }
}

@keyframes pfReqInLeft {
    from { opacity: 0; transform: translate3d(-14px, 0, 0) scale(0.992); }
    to   { opacity: 1; transform: translate3d(0, 0, 0) scale(1); }
}

.pf-req-skeleton {
    display: grid;
    gap: 12px;
    padding: 16px 18px;
    border-radius: 20px;
    background: var(--pf-surface);
}
.pf-req-skeleton__row { display: flex; align-items: center; gap: 13px; }
.pf-req-skeleton__thumb { width: 56px; height: 56px; border-radius: 14px; background: var(--pf-surface-strong); flex-shrink: 0; }
.pf-req-skeleton__lines { flex: 1; display: grid; gap: 7px; }
.pf-req-skeleton__line { height: 12px; border-radius: 999px; background: var(--pf-surface-strong); }
.pf-req-skeleton__bar { height: 42px; border-radius: 14px; background: var(--pf-surface-strong); opacity: 0.6; }

@media (prefers-reduced-motion: reduce) {
    .profile-req-tool-btn,
    .profile-req-tool-btn .pf-icon,
    .profile-req-tool-badge,
    .profile-req-trash-banner,
    .profile-requests-list,
    .profile-req-card {
        transition-duration: 0.01ms !important;
        animation-duration: 0.01ms !important;
        animation-delay: 0s !important;
    }
}

.profile-req-card {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 16px 18px;
    border-radius: 20px;
    background: var(--pf-surface);
    border: none;
    box-sizing: border-box;
    contain: layout style;
    transition: opacity 0.22s ease, transform 0.24s cubic-bezier(0.32, 0.72, 0, 1);
}

.profile-req-card.is-removing {
    opacity: 0;
    transform: translate3d(0, 6px, 0) scale(0.978);
    pointer-events: none;
}

.profile-req-head {
    display: flex;
    align-items: center;
    gap: 13px;
    min-width: 0;
}

.profile-req-thumb-wrap {
    position: relative;
    width: 56px;
    height: 56px;
    border-radius: 14px;
    overflow: hidden;
    background: var(--pf-surface-strong);
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

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

.profile-req-thumb-fallback {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--pf-text-muted);
}

.profile-req-thumb-fallback[hidden] {
    display: none;
}

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

.profile-req-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 3px;
}

.profile-req-name {
    min-width: 0;
    flex: 1;
    font-size: 0.92rem;
    font-weight: 600;
    color: var(--pf-text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.profile-status-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 3px 10px;
    border-radius: 9999px;
    font-size: 0.74rem;
    font-weight: 500;
    color: var(--pf-text-secondary);
    background: var(--pf-surface-hover);
    flex-shrink: 0;
}

.profile-status-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--pf-text-muted);
}

.profile-status-pill.pending {
    color: var(--pf-warning);
    background: var(--pf-warning-subtle);
}
.profile-status-pill.pending .profile-status-dot { background: var(--pf-warning); }

.profile-status-pill.in_progress {
    color: var(--pf-accent);
    background: rgba(37, 99, 235, 0.1);
}
.profile-status-pill.in_progress .profile-status-dot { background: var(--pf-accent); }

.profile-status-pill.done {
    color: var(--pf-success);
    background: var(--pf-success-subtle);
}
.profile-status-pill.done .profile-status-dot { background: var(--pf-success); }

.profile-status-pill.rejected {
    color: var(--pf-danger);
    background: var(--pf-danger-subtle);
}
.profile-status-pill.rejected .profile-status-dot { background: var(--pf-danger); }

body.dark-mode .profile-status-pill.in_progress,
html.dark-mode .profile-status-pill.in_progress,
[data-theme="dark"] .profile-status-pill.in_progress {
    background: rgba(96, 165, 250, 0.16);
}

.profile-req-sub {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
    font-size: 0.78rem;
    color: var(--pf-text-secondary);
}

/* --- Timeline Status Stepper (Desktop: Horizontal 3-col, Mobile <=640px: Vertical) --- */
.pf-req-timeline {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0;
    padding: 14px 12px 12px;
    border-radius: 15px;
    background: rgba(255, 255, 255, 0.56);
    box-sizing: border-box;
}

body.dark-mode .pf-req-timeline,
html.dark-mode .pf-req-timeline,
[data-theme="dark"] .pf-req-timeline {
    background: rgba(255, 255, 255, 0.035);
}

.pf-tl-step {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 0 6px;
    min-width: 0;
    box-sizing: border-box;
}

.pf-tl-step:not(:last-child)::after {
    content: '';
    position: absolute;
    top: 11px;
    left: calc(50% + 16px);
    width: calc(100% - 32px);
    height: 2px;
    border-radius: 999px;
    background: var(--pf-surface-strong);
    z-index: 1;
}

.pf-tl-step.is-line-done:not(:last-child)::after {
    background: var(--pf-success);
    opacity: 0.65;
}

.pf-tl-step.is-line-warn:not(:last-child)::after {
    background: linear-gradient(90deg, var(--pf-success) 0%, var(--pf-warning) 100%);
    opacity: 0.55;
}

.pf-tl-step.is-line-progress:not(:last-child)::after {
    background: var(--pf-accent);
    opacity: 0.45;
}

.pf-tl-step.is-line-rejected:not(:last-child)::after {
    background: var(--pf-danger);
    opacity: 0.6;
}

.pf-tl-node {
    position: relative;
    z-index: 2;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--pf-bg);
    color: var(--pf-text-muted);
    box-shadow: inset 0 0 0 1.5px var(--pf-surface-strong);
    box-sizing: border-box;
    flex-shrink: 0;
}

.pf-tl-node .pf-icon {
    stroke-width: 2.35;
}

.pf-tl-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--pf-text-muted);
    opacity: 0.55;
}

.pf-tl-step.is-done .pf-tl-node {
    background: var(--pf-success);
    color: #ffffff;
    box-shadow: none;
}

body.dark-mode .pf-tl-step.is-done .pf-tl-node,
html.dark-mode .pf-tl-step.is-done .pf-tl-node,
[data-theme="dark"] .pf-tl-step.is-done .pf-tl-node {
    color: #052e16;
}

.pf-tl-step.is-current.is-warn .pf-tl-node {
    background: var(--pf-warning-subtle);
    color: var(--pf-warning);
    box-shadow: 0 0 0 4px rgba(245, 158, 11, 0.12), inset 0 0 0 1.5px var(--pf-warning);
}

.pf-tl-step.is-current.is-warn .pf-tl-dot {
    width: 8px;
    height: 8px;
    background: var(--pf-warning);
    opacity: 1;
}

.pf-tl-step.is-current.is-progress .pf-tl-node {
    background: rgba(37, 99, 235, 0.12);
    color: var(--pf-accent);
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.1), inset 0 0 0 1.5px var(--pf-accent);
}

body.dark-mode .pf-tl-step.is-current.is-progress .pf-tl-node,
html.dark-mode .pf-tl-step.is-current.is-progress .pf-tl-node,
[data-theme="dark"] .pf-tl-step.is-current.is-progress .pf-tl-node {
    background: rgba(96, 165, 250, 0.18);
    box-shadow: 0 0 0 4px rgba(96, 165, 250, 0.12), inset 0 0 0 1.5px var(--pf-accent);
}

.pf-tl-step.is-rejected .pf-tl-node {
    background: var(--pf-danger);
    color: #ffffff;
    box-shadow: none;
}

body.dark-mode .pf-tl-step.is-rejected .pf-tl-node,
html.dark-mode .pf-tl-step.is-rejected .pf-tl-node,
[data-theme="dark"] .pf-tl-step.is-rejected .pf-tl-node {
    color: #450a0a;
}

.pf-tl-body {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    margin-top: 7px;
    min-width: 0;
    width: 100%;
}

.pf-tl-title {
    font-size: 0.77rem;
    font-weight: 600;
    color: var(--pf-text-primary);
    line-height: 1.3;
}

.pf-tl-step.is-upcoming .pf-tl-title {
    color: var(--pf-text-muted);
    font-weight: 500;
}

.pf-tl-step.is-current.is-warn .pf-tl-title {
    color: var(--pf-warning);
}

.pf-tl-step.is-current.is-progress .pf-tl-title {
    color: var(--pf-accent);
}

.pf-tl-step.is-rejected .pf-tl-title {
    color: var(--pf-danger);
}

.pf-tl-sub {
    font-size: 0.7rem;
    color: var(--pf-text-muted);
    line-height: 1.35;
    font-variant-numeric: tabular-nums;
    word-break: break-word;
}

.profile-req-note {
    font-size: 0.8rem;
    color: var(--pf-text-primary);
    opacity: 0.85;
    line-height: 1.5;
}

.profile-req-admin {
    padding: 9px 12px;
    border-radius: 12px;
    background: var(--pf-surface-hover);
    font-size: 0.78rem;
    color: var(--pf-text-primary);
    display: flex;
    align-items: flex-start;
    gap: 8px;
    line-height: 1.48;
}

.profile-req-admin .pf-icon {
    margin-top: 2px;
    color: var(--pf-text-secondary);
    flex-shrink: 0;
}

.profile-req-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    flex-wrap: wrap;
}

.profile-req-foot-hint {
    font-size: 0.73rem;
    color: var(--pf-text-muted);
}

.profile-btn-cancel-req,
.profile-btn-softdel-req,
.profile-btn-restore-req {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: transparent;
    border: none;
    padding: 4px 10px;
    border-radius: 9999px;
    font-family: inherit;
    font-size: 0.76rem;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.16s ease, opacity 0.16s ease, color 0.16s ease;
    margin-left: auto;
}

.profile-btn-cancel-req,
.profile-btn-softdel-req {
    color: var(--pf-danger);
    opacity: 0.88;
}

.profile-btn-restore-req {
    color: var(--pf-accent);
    background: rgba(37, 99, 235, 0.08);
    padding: 5px 12px;
}

body.dark-mode .profile-btn-restore-req,
html.dark-mode .profile-btn-restore-req,
[data-theme="dark"] .profile-btn-restore-req {
    background: rgba(96, 165, 250, 0.15);
}

.profile-btn-cancel-req:disabled,
.profile-btn-softdel-req:disabled,
.profile-btn-restore-req:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.profile-empty-state.is-compact {
    padding: 36px 20px;
}

@media (max-width: 640px) {
    .profile-req-card {
        padding: 14px;
        border-radius: 18px;
        gap: 11px;
    }

    .profile-req-head {
        align-items: flex-start;
        gap: 11px;
    }

    .profile-req-thumb-wrap {
        width: 50px;
        height: 50px;
        border-radius: 12px;
    }

    .profile-req-top {
        gap: 8px;
    }

    .pf-req-timeline {
        grid-template-columns: 1fr;
        padding: 12px 13px;
    }

    .pf-tl-step {
        display: grid;
        grid-template-columns: 24px minmax(0, 1fr);
        column-gap: 11px;
        align-items: start;
        text-align: left;
        padding: 0 0 13px 0;
    }

    .pf-tl-step:last-child {
        padding-bottom: 0;
    }

    .pf-tl-step:not(:last-child)::after {
        top: 28px;
        left: 11px;
        width: 2px;
        height: calc(100% - 32px);
    }

    .pf-tl-step.is-line-warn:not(:last-child)::after {
        background: linear-gradient(180deg, var(--pf-success) 0%, var(--pf-warning) 100%);
    }

    .pf-tl-body {
        flex-direction: row;
        flex-wrap: wrap;
        align-items: baseline;
        justify-content: space-between;
        gap: 2px 10px;
        margin-top: 2px;
    }
}

@media (hover: hover) and (pointer: fine) {
    .profile-btn-cancel-req:hover:not(:disabled),
    .profile-btn-softdel-req:hover:not(:disabled) {
        opacity: 1;
        background: var(--pf-danger-subtle);
    }

    .profile-btn-restore-req:hover:not(:disabled) {
        background: rgba(37, 99, 235, 0.15);
    }
}

/* ==========================================================================
   10. Tab 5: Settings & PDPA (iOS Settings Group Style)
   ========================================================================== */
.profile-settings-stack {
    max-width: 680px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.profile-set-section {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.profile-set-heading {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--pf-text-muted);
    margin: 0;
    padding: 0 14px;
    letter-spacing: 0.02em;
}

.profile-set-group {
    border-radius: 20px;
    background: var(--pf-surface);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.profile-set-row {
    width: 100%;
    box-sizing: border-box;
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 18px;
    background: transparent;
    border: none;
    border-bottom: 1px solid var(--pf-hairline);
    color: var(--pf-text-primary);
    font-family: inherit;
    text-align: left;
    text-decoration: none;
}

.profile-set-row:last-child {
    border-bottom: none;
}

.profile-set-row.is-action,
.profile-set-row.is-toggle {
    cursor: pointer;
    transition: background 0.18s ease, opacity 0.18s ease;
}

@media (hover: hover) and (pointer: fine) {
    .profile-set-row.is-action:hover,
    .profile-set-row.is-toggle:hover {
        background: var(--pf-surface-hover);
    }
}

.profile-set-row.is-toggle.is-saving,
.profile-set-row.profile-set-side-row.is-saving {
    opacity: 0.72;
}

/* Sub-block pairing Capsule Visibility Toggle + Left/Right Side Segmented Control */
.profile-set-subblock {
    border-bottom: 1px solid var(--pf-hairline);
}

.profile-set-subblock:last-child {
    border-bottom: none;
}

.profile-set-subblock .profile-set-row.is-toggle {
    border-bottom: none;
    padding-bottom: 10px;
}

.profile-set-side-row {
    padding: 8px 18px 14px 66px;
    border-bottom: none;
    gap: 12px;
}

.profile-set-sublabel {
    font-size: 0.84rem;
    font-weight: 500;
}

.pf-side-segment {
    display: inline-flex;
    align-items: center;
    padding: 3px;
    border-radius: 11px;
    background: var(--pf-surface);
    border: 1px solid var(--pf-hairline);
    gap: 2px;
    flex-shrink: 0;
}

.pf-side-seg-btn {
    min-width: 54px;
    height: 30px;
    padding: 0 12px;
    border: none;
    border-radius: 8px;
    background: transparent;
    color: var(--pf-text-secondary);
    font-family: inherit;
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    transition: background-color 0.18s ease, color 0.18s ease, box-shadow 0.18s ease, transform 0.14s ease;
}

.pf-side-seg-btn:active {
    transform: scale(0.96);
}

.pf-side-seg-btn.active {
    background: var(--pf-card-bg, #ffffff);
    color: var(--pf-text-primary);
    font-weight: 600;
    box-shadow: 0 1px 4px rgba(15, 23, 42, 0.1), 0 0 0 1px rgba(15, 23, 42, 0.05);
}

body.dark-mode .pf-side-seg-btn.active,
html.dark-mode .pf-side-seg-btn.active,
[data-theme="dark"] .pf-side-seg-btn.active {
    background: rgba(255, 255, 255, 0.16);
    color: #ffffff;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.12);
}

@media (max-width: 560px) {
    .profile-set-side-row {
        padding: 6px 16px 14px 16px;
        flex-wrap: wrap;
        justify-content: space-between;
    }
}

/* Category Dropdown Accordion (.profile-set-cat) */
.profile-set-cat {
    border-bottom: 1px solid var(--pf-hairline);
}

.profile-set-cat:last-child {
    border-bottom: none;
}

.profile-set-cat-trigger {
    width: 100%;
    box-sizing: border-box;
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 15px 18px;
    background: transparent;
    border: none;
    color: var(--pf-text-primary);
    font-family: inherit;
    text-align: left;
    cursor: pointer;
    transition: background 0.18s ease;
    -webkit-tap-highlight-color: transparent;
}

@media (hover: hover) and (pointer: fine) {
    .profile-set-cat-trigger:hover {
        background: var(--pf-surface-hover);
    }
}

.profile-set-cat-trigger .profile-set-label {
    font-size: 0.94rem;
    font-weight: 600;
}

.profile-set-cat-chevron {
    transition: transform 0.28s cubic-bezier(0.22, 1, 0.36, 1);
}

.profile-set-cat.is-open .profile-set-cat-chevron {
    transform: rotate(180deg);
}

.profile-set-cat-body {
    display: grid;
    grid-template-rows: 0fr;
    opacity: 0;
    transition: grid-template-rows 0.3s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.22s ease;
}

.profile-set-cat.is-open .profile-set-cat-body {
    grid-template-rows: 1fr;
    opacity: 1;
}

.profile-set-cat-inner {
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.profile-set-cat-inner > .profile-set-row:first-child {
    border-top: 1px solid var(--pf-hairline);
}

.profile-set-cat-inner .profile-set-row {
    padding-left: 22px;
}

.profile-set-cat-inner .profile-set-icon {
    width: 30px;
    height: 30px;
    border-radius: 9px;
}

.pf-switch {
    position: relative;
    display: inline-flex;
    align-items: center;
    flex-shrink: 0;
    margin-left: auto;
}

.pf-switch-input {
    position: absolute;
    opacity: 0;
    width: 46px;
    height: 28px;
    margin: 0;
    cursor: pointer;
}

.pf-switch-track {
    position: relative;
    display: inline-flex;
    align-items: center;
    width: 46px;
    height: 28px;
    padding: 3px;
    box-sizing: border-box;
    border-radius: 9999px;
    background: var(--pf-surface-strong);
    box-shadow: inset 0 0 0 1px var(--pf-hairline);
    transition: background-color 0.24s cubic-bezier(0.22, 1, 0.36, 1),
                box-shadow 0.24s ease;
}

.pf-switch-thumb {
    width: 22px;
    height: 22px;
    border-radius: 9999px;
    background: #ffffff;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.18), 0 0 1px rgba(0, 0, 0, 0.12);
    transform: translate3d(0, 0, 0);
    transition: transform 0.28s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.pf-switch-input:checked + .pf-switch-track {
    background: #10b981;
    box-shadow: inset 0 0 0 1px rgba(5, 150, 105, 0.25);
}

.pf-switch-input:checked + .pf-switch-track .pf-switch-thumb {
    transform: translate3d(18px, 0, 0);
}

.pf-switch-input:focus-visible + .pf-switch-track {
    outline: 2px solid var(--pf-accent);
    outline-offset: 2px;
}

.profile-set-icon {
    width: 34px;
    height: 34px;
    border-radius: 10px;
    background: var(--pf-surface-hover);
    color: var(--pf-text-primary);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.profile-set-icon.success {
    background: var(--pf-success-subtle);
    color: var(--pf-success);
}

.profile-set-row.is-opted-out .profile-set-icon {
    background: var(--pf-danger-subtle);
    color: var(--pf-danger);
}

.profile-set-text {
    min-width: 0;
    flex: 1;
}

.profile-set-label {
    font-size: 0.88rem;
    font-weight: 500;
    color: var(--pf-text-primary);
    line-height: 1.3;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}

.pf-optout-status-pill {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: 9999px;
    font-size: 0.7rem;
    font-weight: 600;
    background: var(--pf-danger-subtle);
    color: var(--pf-danger);
    line-height: 1.4;
}

.pf-optout-status-pill[hidden] {
    display: none !important;
}

.pf-face-status-badge.is-opted-out {
    background: var(--pf-danger-subtle);
    color: var(--pf-danger);
    border-color: rgba(239, 68, 68, 0.24);
}

.pf-face-status-badge.is-opted-out .pf-face-status-dot {
    background: var(--pf-danger);
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.18);
}

.profile-set-desc {
    font-size: 0.75rem;
    color: var(--pf-text-secondary);
    margin-top: 1px;
}

.profile-set-value {
    font-size: 0.85rem;
    color: var(--pf-text-secondary);
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.profile-set-value-text {
    color: var(--pf-text-primary);
    font-weight: 500;
    word-break: break-word;
    text-align: right;
}

.profile-account-groups .profile-group-badge {
    background: var(--pf-bg);
}

.profile-set-ok {
    color: var(--pf-success);
    font-weight: 500;
}

.profile-set-muted {
    color: var(--pf-text-muted);
}

.profile-set-chevron {
    color: var(--pf-text-muted);
    display: inline-flex;
    transition: transform 0.2s ease;
}

.profile-set-row.is-expanded .pf-consent-history-chevron {
    transform: rotate(180deg);
}

.pf-consent-history-panel {
    border-top: 1px solid var(--pf-border-subtle, rgba(0, 0, 0, 0.06));
    background: var(--pf-surface-hover, rgba(0, 0, 0, 0.02));
}

.pf-consent-history-inner {
    padding: 10px 16px 14px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 280px;
    overflow-y: auto;
}

.pf-consent-history-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 8px 12px;
    border-radius: 12px;
    background: var(--pf-surface);
    border: 1px solid var(--pf-border-subtle, rgba(0, 0, 0, 0.06));
}

.pf-consent-history-main {
    min-width: 0;
    flex: 1;
}

.pf-consent-history-purpose {
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--pf-text-primary);
    line-height: 1.35;
}

.pf-consent-history-meta {
    font-size: 0.72rem;
    color: var(--pf-text-secondary);
    margin-top: 2px;
}

.pf-consent-history-badge {
    flex-shrink: 0;
    font-size: 0.7rem;
    font-weight: 600;
    padding: 3px 9px;
    border-radius: 9999px;
    line-height: 1.3;
}

.pf-consent-history-badge.is-granted {
    background: var(--pf-success-subtle);
    color: var(--pf-success);
}

.pf-consent-history-badge.is-withdrawn {
    background: var(--pf-danger-subtle);
    color: var(--pf-danger);
}

.pf-consent-history-empty {
    font-size: 0.78rem;
    color: var(--pf-text-secondary);
    padding: 8px 4px;
    text-align: center;
}

.profile-danger-zone {
    padding: 8px 14px 0;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
}

.profile-danger-btn {
    background: transparent;
    border: none;
    padding: 0;
    color: var(--pf-danger);
    font-family: inherit;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: opacity 0.15s ease;
}

@media (hover: hover) and (pointer: fine) {
    .profile-danger-btn:hover {
        text-decoration: underline;
    }
}

.profile-danger-desc {
    font-size: 0.74rem;
    color: var(--pf-text-muted);
    margin: 0;
    line-height: 1.5;
}

/* ==========================================================================
   11. Empty States & Guest Login Gate
   ========================================================================== */
.profile-empty-state {
    padding: 64px 20px;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.profile-empty-icon {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--pf-surface);
    color: var(--pf-text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 16px;
}

.profile-empty-title {
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--pf-text-primary);
    margin: 0 0 6px;
}

.profile-empty-desc {
    font-size: 0.85rem;
    color: var(--pf-text-secondary);
    max-width: 340px;
    margin: 0 0 20px;
    line-height: 1.55;
}

.pf-face-status-badge {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 5px 12px;
    border-radius: 9999px;
    background: var(--pf-success-subtle);
    color: var(--pf-success);
    font-size: 0.76rem;
    font-weight: 600;
    margin-bottom: 12px;
}

.pf-face-status-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--pf-success);
    flex-shrink: 0;
}

.pf-empty-actions {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    margin-top: 4px;
    width: 100%;
    max-width: 240px;
}

.pf-empty-actions .profile-pill-btn {
    width: 100%;
    justify-content: center;
}

.pf-empty-danger-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 9999px;
    border: none;
    background: transparent;
    color: var(--pf-danger);
    font-family: inherit;
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    opacity: 0.85;
    transition: opacity 0.18s ease, background 0.18s ease;
}

@media (hover: hover) and (pointer: fine) {
    .pf-empty-danger-link:hover {
        opacity: 1;
        background: var(--pf-danger-subtle);
    }
}

/* Guest Login Gate Card */
.profile-login-gate {
    max-width: 390px;
    margin: 32px auto;
    padding: 36px 32px 30px;
    border-radius: 28px;
    background: var(--pf-card-glass);
    backdrop-filter: blur(32px) saturate(180%);
    -webkit-backdrop-filter: blur(32px) saturate(180%);
    box-shadow: var(--pf-shadow-float);
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.profile-login-gate-icon {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    background: var(--pf-surface-strong);
    color: var(--pf-text-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 18px;
}

.profile-login-gate-title {
    font-size: 1.35rem;
    font-weight: 600;
    color: var(--pf-text-primary);
    margin: 0 0 8px;
    letter-spacing: -0.02em;
}

.profile-login-gate-desc {
    font-size: 0.86rem;
    color: var(--pf-text-secondary);
    margin: 0 0 24px;
    line-height: 1.55;
}

.profile-google-login-btn {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 13px 22px;
    border-radius: 9999px;
    border: none;
    background: linear-gradient(180deg, #27272a 0%, #18181b 100%);
    color: #ffffff;
    font-family: inherit;
    font-size: 0.92rem;
    font-weight: 500;
    cursor: pointer;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.14);
    transition: filter 0.2s ease, transform 0.18s ease;
}

@media (hover: hover) and (pointer: fine) {
    .profile-google-login-btn:hover {
        filter: brightness(1.12);
        transform: translateY(-1px);
    }
}

.profile-google-login-btn:active {
    transform: scale(0.98);
}

.profile-login-benefits {
    list-style: none;
    padding: 0;
    margin: 24px 0 0;
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 10px;
    text-align: left;
}

.profile-login-benefit-item {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.82rem;
    color: var(--pf-text-secondary);
}

.profile-login-benefit-item .pf-icon {
    color: var(--pf-text-primary);
}

/* ==========================================================================
   12. Responsive Design (Tablet & Mobile)
   ========================================================================== */
@media (max-width: 960px) {
    .profile-fav-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    .profile-albums-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* บน iPad & iOS Safari ทุกขนาดจอ: ตรึงแถบแท็บไว้ใต้ Navbar เพื่อไม่ให้เลื่อนตามนิ้วหรือเด้ง */
html.pg-ios-safari body.profile-page .pg-navbar.scrolled {
    background-color: var(--pf-sticky-header-bg);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border-bottom: none;
    box-shadow: none;
}

html.pg-ios-safari .profile-tabs-bar {
    position: sticky;
    top: 70px;
    z-index: 80;
    background: var(--pf-sticky-header-bg);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    touch-action: pan-x;
    overscroll-behavior-x: contain;
}

@media (max-width: 768px) {
    body.profile-page .pg-navbar {
        height: 60px;
        padding: 0 4%;
    }

    .profile-container {
        padding: 72px 16px 104px;
    }

    .profile-header {
        padding: 4px 0 18px;
    }

    .profile-avatar-wrap,
    .profile-avatar-img,
    .profile-avatar-fallback {
        width: 56px;
        height: 56px;
    }

    /* บนมือถือ (Chrome/Android/PWA) ซ่อนแถบแท็บด้านบน แล้วใช้ Floating Bottom Dock
       ส่วนบน iOS Safari ใช้แถบแท็บด้านบนแบบ Sticky ใต้ Navbar เพื่อไม่ให้ชนปุ่มลอยของ Safari */
    html:not(.pg-ios-safari) .profile-tabs-bar {
        display: none !important;
    }

    html.pg-ios-safari .profile-container {
        padding-bottom: calc(44px + env(safe-area-inset-bottom, 0px));
    }

    html.pg-ios-safari body.profile-page .pg-navbar.scrolled {
        background-color: var(--pf-sticky-header-bg);
        backdrop-filter: blur(20px) saturate(180%);
        -webkit-backdrop-filter: blur(20px) saturate(180%);
        border-bottom: none;
        box-shadow: none;
    }

    html.pg-ios-safari .profile-tabs-bar {
        position: sticky;
        top: 60px;
        z-index: 80;
        width: 100vw;
        margin-left: calc(50% - 50vw);
        margin-right: calc(50% - 50vw);
        margin-top: 0;
        margin-bottom: 18px;
        padding: 0;
        background: var(--pf-sticky-header-bg);
        backdrop-filter: blur(20px) saturate(180%);
        -webkit-backdrop-filter: blur(20px) saturate(180%);
    }

    html.pg-ios-safari .profile-tabs-scroller {
        max-width: 100%;
        padding: 0 6px;
        display: grid;
        grid-auto-flow: column;
        grid-auto-columns: minmax(0, 1fr);
        gap: 0;
        overflow: visible;
    }

    html.pg-ios-safari .profile-tab-btn {
        flex-direction: column;
        justify-content: center;
        align-items: center;
        gap: 3px;
        padding: 9px 1px 10px;
        font-size: 0.65rem;
        text-align: center;
        width: 100%;
    }

    html.pg-ios-safari .profile-tab-btn svg {
        width: 16px;
        height: 16px;
    }

    html.pg-ios-safari .profile-tab-btn::after {
        left: 18%;
        right: 18%;
    }

    html.pg-ios-safari .profile-tab-label .pf-lg {
        display: none;
    }

    html.pg-ios-safari .profile-tab-label .pf-sm {
        display: inline;
    }

    html.pg-ios-safari .profile-tab-count {
        display: none;
    }

    html.pg-ios-safari body.profile-page:not(.lightbox-open) .pg-toast {
        bottom: calc(22px + env(safe-area-inset-bottom, 0px));
    }

    body.pg-profile-tab-docked:not(.lightbox-open):not(.pg-floating-tabs-obscured) .pg-toast {
        bottom: calc(82px + env(safe-area-inset-bottom, 0px));
    }

    /* แถบโหมดเลือกรูปลอยด้านล่างจอบนมือถือ (ระยะนิ้วโป้ง) */
    .profile-fav-toolbar.is-selecting .profile-selbar {
        position: fixed;
        bottom: calc(16px + env(safe-area-inset-bottom, 0px));
        left: 16px;
        right: 16px;
        z-index: 95;
        background: var(--pf-glass);
        backdrop-filter: blur(24px) saturate(180%);
        -webkit-backdrop-filter: blur(24px) saturate(180%);
        box-shadow: var(--pf-shadow-float);
        padding: 10px 16px;
    }
}

@media (max-width: 560px) {
    .profile-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 14px;
    }

    .profile-hero-actions {
        width: 100%;
    }

    .profile-hero-actions .profile-pill-btn {
        flex: 1;
    }

    .profile-fav-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }

    .profile-albums-grid {
        grid-template-columns: 1fr;
        gap: 18px;
    }

    .profile-set-row {
        flex-wrap: wrap;
        padding: 12px 14px;
    }

    .profile-set-value {
        width: 100%;
        justify-content: flex-start;
        padding-left: 48px;
        margin-top: -4px;
    }

    .profile-set-cat-inner .profile-set-value {
        padding-left: 44px;
    }

    .profile-set-value-text {
        text-align: left;
    }

    .profile-set-row.is-action,
    .profile-set-row.is-toggle {
        flex-wrap: nowrap;
    }

    .profile-set-row.is-action .profile-set-value {
        width: auto;
        padding-left: 0;
    }
}


/* consolidated in 6.1 */

/* History Filter Modal Button & Active Filter Chips */
.profile-filter-modal-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    height: 38px;
    padding: 0 16px;
    border-radius: 9999px;
    background: var(--pf-surface);
    border: none;
    outline: none;
    color: var(--pf-text-primary);
    font-family: inherit;
    font-size: 0.86rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.18s ease;
}

@media (hover: hover) and (pointer: fine) {
    .profile-filter-modal-btn:hover {
        background: var(--pf-surface-hover);
    }
}

.profile-filter-modal-btn.has-filters {
    border: none;
    background: rgba(37, 99, 235, 0.12);
    color: #2563eb;
}

body.dark-mode .profile-filter-modal-btn.has-filters,
html.dark-mode .profile-filter-modal-btn.has-filters,
[data-theme="dark"] .profile-filter-modal-btn.has-filters {
    border: none;
    background: rgba(37, 99, 235, 0.2);
    color: #93c5fd;
}

.profile-filter-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 9999px;
    background: #2563eb;
    color: #ffffff;
    font-size: 0.72rem;
    font-weight: 600;
    line-height: 1;
}

.profile-active-filters {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.profile-filter-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 32px;
    padding: 0 12px;
    border-radius: 9999px;
    background: rgba(37, 99, 235, 0.1);
    border: none;
    outline: none;
    color: #2563eb;
    font-size: 0.82rem;
    font-weight: 500;
}

body.dark-mode .profile-filter-chip,
html.dark-mode .profile-filter-chip,
[data-theme="dark"] .profile-filter-chip {
    background: rgba(37, 99, 235, 0.2);
    border: none;
    color: #93c5fd;
}

.profile-chip-remove {
    background: transparent;
    border: none;
    color: inherit;
    cursor: pointer;
    font-size: 0.85rem;
    padding: 0;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    opacity: 0.75;
    transition: opacity 0.15s;
}

@media (hover: hover) and (pointer: fine) {
    .profile-chip-remove:hover {
        opacity: 1;
    }
}

/* Modal ตัวกรองประวัติการดาวน์โหลด (Floating Glassmorphism ตามแบบหน้า Index / รูปที่ 2) */
.profile-modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: rgba(15, 23, 42, 0.38);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    opacity: 0;
    transition: opacity 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}

body.dark-mode .profile-modal-overlay,
html.dark-mode .profile-modal-overlay,
[data-theme="dark"] .profile-modal-overlay {
    background: rgba(0, 0, 0, 0.62);
}

.profile-modal-overlay.open {
    opacity: 1;
}

.profile-modal-overlay .album-filter-modal-card {
    transform: scale(0.95) translateY(10px);
    transition: transform 0.24s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.24s ease;
}

.profile-modal-overlay.open .album-filter-modal-card {
    transform: scale(1) translateY(0);
}

/* ==========================================================================
   My Photos Incremental Loader & Settings Document Links
   ========================================================================== */
.profile-my-more-wrap {
    margin-top: 22px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.profile-my-more-status {
    font-size: 0.78rem;
    color: var(--pf-text-muted);
}

.profile-my-more-btn {
    min-width: 220px;
}

.profile-my-sentinel {
    width: 100%;
    height: 1px;
    pointer-events: none;
}

.profile-set-doc-links {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 6px;
}

.profile-set-doc-link {
    font-size: 0.77rem;
    font-weight: 500;
    color: var(--pf-accent);
    text-decoration: none;
    transition: opacity 0.16s ease;
}

@media (hover: hover) and (pointer: fine) {
    .profile-set-doc-link:hover {
        text-decoration: underline;
        opacity: 0.85;
    }
}

/* ==========================================================================
   My Photos: Active Album Filter Bar, Pagination & Searchable Album Picker
   ========================================================================== */
.pf-album-active-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 16px;
    padding: 10px 14px;
    border-radius: 14px;
    background: var(--pf-surface);
}

.pf-album-clear-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    border: none;
    background: var(--pf-modal-bg, #ffffff);
    color: var(--pf-text-primary);
    padding: 6px 12px;
    border-radius: 9999px;
    font-family: inherit;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.07);
}

body.dark-mode .pf-album-clear-btn,
html.dark-mode .pf-album-clear-btn,
[data-theme="dark"] .pf-album-clear-btn {
    background: rgba(255, 255, 255, 0.12);
    color: #ffffff;
}

.pf-album-active-info {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
    flex: 1;
}

.pf-album-active-name {
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--pf-text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.pf-album-active-actions {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.pf-pagination-bar {
    margin-top: 22px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.pf-pagination-info {
    font-size: 0.78rem;
    color: var(--pf-text-muted);
    font-variant-numeric: tabular-nums;
}

.pf-pagination-controls {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 6px;
}

.pf-page-btn {
    min-width: 36px;
    height: 36px;
    padding: 0 10px;
    border: none;
    border-radius: 10px;
    background: var(--pf-surface);
    color: var(--pf-text-primary);
    font-family: inherit;
    font-size: 0.82rem;
    font-weight: 500;
    font-variant-numeric: tabular-nums;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.16s ease, color 0.16s ease;
}

@media (hover: hover) and (pointer: fine) {
    .pf-page-btn:hover:not(:disabled):not(.active) {
        background: var(--pf-surface-hover);
    }
}

.pf-page-btn.active {
    background: var(--pf-primary-bg);
    color: var(--pf-primary-fg);
    font-weight: 600;
}

.pf-page-btn:disabled {
    opacity: 0.35;
    cursor: not-allowed;
}

.pf-page-ellipsis {
    padding: 0 4px;
    color: var(--pf-text-muted);
    font-size: 0.85rem;
}

/* Searchable Album Picker Modal / Mobile Sheet (60/120fps GPU-Composited iOS Sheet) */
html.pf-picker-open,
body.pf-picker-open {
    overflow: hidden !important;
    overscroll-behavior: none !important;
}

body.pf-picker-open .profile-container,
body.pf-picker-open .pg-navbar,
body.pf-picker-open .pg-floating-tabs-dock {
    pointer-events: none !important;
    user-select: none !important;
}

.pf-album-picker-overlay {
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    background: transparent !important;
    opacity: 1 !important;
    visibility: hidden;
    pointer-events: none;
    transition: none !important;
    contain: layout style;
}

.pf-album-picker-overlay.is-closing {
    visibility: visible;
    pointer-events: none;
}

.pf-album-picker-overlay.open {
    visibility: visible;
    pointer-events: auto;
}

.pf-album-picker-backdrop {
    position: absolute;
    inset: 0;
    z-index: 0;
    background: rgba(15, 23, 42, 0.46);
    opacity: 0;
    will-change: opacity;
    transform: translateZ(0);
    transition: opacity 0.28s cubic-bezier(0.32, 0.72, 0, 1);
}

body.dark-mode .pf-album-picker-backdrop,
html.dark-mode .pf-album-picker-backdrop,
[data-theme="dark"] .pf-album-picker-backdrop {
    background: rgba(0, 0, 0, 0.66);
}

.pf-album-picker-overlay.open .pf-album-picker-backdrop {
    opacity: 1;
}

.pf-album-picker-overlay.is-dragging .pf-album-picker-backdrop {
    transition: none !important;
}

.pf-album-picker-card {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 480px;
    max-height: min(76vh, 620px);
    display: flex;
    flex-direction: column;
    border-radius: 22px;
    background: var(--pf-modal-bg, #ffffff);
    color: var(--pf-text-primary);
    box-shadow: var(--pf-modal-shadow);
    overflow: hidden;
    transform: translate3d(0, calc(55vh + 60%), 0);
    opacity: 1;
    will-change: transform;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    contain: layout style paint;
    transition: transform 0.34s cubic-bezier(0.32, 0.72, 0, 1);
    overscroll-behavior: contain;
}

.pf-album-picker-card.is-dragging {
    transition: none !important;
    will-change: transform;
}

.pf-album-picker-card.is-dragging .pf-album-picker-list {
    pointer-events: none;
}

.pf-album-picker-overlay.open .pf-album-picker-card {
    transform: translate3d(0, 0, 0);
    opacity: 1;
}

.pf-album-picker-handle-wrap {
    display: none;
    align-items: center;
    justify-content: center;
    padding: 10px 0 2px;
    touch-action: none;
    cursor: grab;
    flex-shrink: 0;
}

.pf-album-picker-handle {
    width: 38px;
    height: 4px;
    border-radius: 9999px;
    background: rgba(15, 23, 42, 0.18);
}

body.dark-mode .pf-album-picker-handle,
html.dark-mode .pf-album-picker-handle,
[data-theme="dark"] .pf-album-picker-handle {
    background: rgba(255, 255, 255, 0.26);
}

@media (hover: none), (pointer: coarse) {
    .pf-album-picker-handle-wrap {
        display: flex;
    }

    .pf-album-picker-head {
        padding-top: 8px;
        touch-action: none;
    }
}

.pf-album-picker-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 18px 13px;
    border-bottom: 1px solid var(--pf-hairline);
}

.pf-album-picker-title {
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
}

.pf-album-picker-close {
    width: 34px;
    height: 34px;
    border: none;
    border-radius: 50%;
    background: var(--pf-surface);
    color: var(--pf-text-primary);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.pf-album-picker-list {
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-y: contain;
    contain: layout style;
    padding: 10px 10px 14px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.pf-picker-item {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 9px 10px;
    border: none;
    border-radius: 14px;
    background: transparent;
    color: var(--pf-text-primary);
    font-family: inherit;
    text-align: left;
    cursor: pointer;
    contain: layout style paint;
    transition: background-color 0.14s ease;
}

@media (hover: hover) and (pointer: fine) {
    .pf-picker-item:hover {
        background: var(--pf-surface-hover);
    }
}

.pf-picker-item.active {
    background: rgba(37, 99, 235, 0.1);
}

.pf-picker-thumb {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    object-fit: cover;
    background: var(--pf-surface);
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--pf-text-secondary);
}

.pf-picker-text {
    flex: 1;
    min-width: 0;
}

.pf-picker-name {
    font-size: 0.86rem;
    font-weight: 600;
    line-height: 1.3;
    color: var(--pf-text-primary);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.pf-picker-date {
    font-size: 0.74rem;
    color: var(--pf-text-secondary);
    margin-top: 2px;
}

.pf-picker-count {
    padding: 3px 9px;
    border-radius: 9999px;
    background: var(--pf-surface);
    color: var(--pf-text-secondary);
    font-size: 0.75rem;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    flex-shrink: 0;
}

.pf-picker-item.active .pf-picker-count {
    background: var(--pf-accent);
    color: #ffffff;
}

@media (max-width: 768px) {
    .pf-album-picker-overlay {
        align-items: flex-end;
        padding: 0;
    }

    .pf-album-picker-card {
        max-width: 100%;
        max-height: 82vh;
        border-radius: 24px 24px 0 0;
        padding-bottom: env(safe-area-inset-bottom, 0px);
        box-shadow: 0 -8px 28px rgba(15, 23, 42, 0.14);
        transform: translate3d(0, 102%, 0);
        opacity: 1;
        transition: transform 0.34s cubic-bezier(0.32, 0.72, 0, 1);
    }

    body.dark-mode .pf-album-picker-card,
    html.dark-mode .pf-album-picker-card,
    [data-theme="dark"] .pf-album-picker-card {
        box-shadow: 0 -10px 32px rgba(0, 0, 0, 0.56);
    }

    .pf-album-picker-overlay.open .pf-album-picker-card {
        transform: translate3d(0, 0, 0);
        opacity: 1;
    }
}
