/* ============================================================
   PokeFolio — Portfolio/Collection Tracker Styles
   ============================================================ */

/* ── HERO BANNER ── */
.pf-hero {
    position: relative;
    overflow: hidden;
    margin-top: 56px;
    padding: 56px 20px 48px;
    background:
        radial-gradient(ellipse 60% 50% at 20% 80%, rgba(212, 160, 23, 0.12) 0%, transparent 60%),
        radial-gradient(ellipse 50% 60% at 80% 20%, rgba(245, 158, 11, 0.08) 0%, transparent 60%),
        radial-gradient(ellipse 40% 40% at 50% 50%, rgba(139, 92, 246, 0.04) 0%, transparent 50%),
        linear-gradient(160deg, #06080c 0%, #0d0a02 30%, #0a0805 60%, #06080c 100%);
    border-bottom: 1px solid rgba(212, 160, 23, 0.12);
}

/* Animated grid overlay */
.pf-hero::before {
    content: '';
    position: absolute;
    inset: 0;
    background:
        linear-gradient(rgba(212,160,23,0.02) 1px, transparent 1px),
        linear-gradient(90deg, rgba(212,160,23,0.02) 1px, transparent 1px);
    background-size: 50px 50px;
    pointer-events: none;
    z-index: 0;
    animation: pfGridShift 20s linear infinite;
}

/* Top-edge gold glow line */
.pf-hero::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(212,160,23,0.5) 30%, rgba(212,160,23,0.8) 50%, rgba(212,160,23,0.5) 70%, transparent);
    z-index: 2;
}

@keyframes pfGridShift {
    0% { background-position: 0 0, 0 0; }
    100% { background-position: 50px 50px, 50px 50px; }
}

.pf-hero-bg {
    position: absolute; inset: 0; overflow: hidden; pointer-events: none;
}
.pf-hero-orb {
    position: absolute; border-radius: 50%; filter: blur(80px); opacity: 0.3;
    animation: pfOrbFloat 8s ease-in-out infinite alternate;
}
.pf-hero-orb-1 {
    width: 350px; height: 350px;
    background: radial-gradient(circle, #d4a017, #8b6914);
    top: -100px; right: -80px;
    animation: pfOrbFloat 10s ease-in-out infinite alternate;
    opacity: 0.35;
}
.pf-hero-orb-2 {
    width: 250px; height: 250px;
    background: radial-gradient(circle, #00e396, #059669);
    bottom: -80px; left: -60px;
    animation: pfOrbFloat 12s ease-in-out infinite alternate-reverse;
    animation-delay: -3s;
    opacity: 0.2;
}
.pf-hero-orb-3 {
    width: 180px; height: 180px;
    background: radial-gradient(circle, #a78bfa, #6d28d9);
    top: 40%; left: 55%;
    animation: pfOrbFloat 14s ease-in-out infinite alternate;
    animation-delay: -5s;
    opacity: 0.1;
}

/* Extra floating particles */
.pf-hero-bg::before {
    content: '';
    position: absolute;
    width: 120px; height: 120px;
    border-radius: 50%;
    background: rgba(212, 160, 23, 0.1);
    filter: blur(60px);
    top: 30%; left: 20%;
    animation: pfOrbPulse 6s ease-in-out infinite;
}

.pf-hero-bg::after {
    content: '';
    position: absolute;
    width: 80px; height: 80px;
    border-radius: 50%;
    background: rgba(245, 158, 11, 0.08);
    filter: blur(40px);
    bottom: 20%; right: 30%;
    animation: pfOrbPulse 8s ease-in-out infinite;
    animation-delay: -4s;
}

@keyframes pfOrbFloat {
    0% { transform: translate(0, 0) scale(1); }
    100% { transform: translate(25px, -20px) scale(1.15); }
}

@keyframes pfOrbPulse {
    0%, 100% { opacity: 0.3; transform: scale(1); }
    50% { opacity: 0.6; transform: scale(1.3); }
}

.pf-hero-content {
    position: relative; z-index: 1;
    max-width: 900px; margin: 0 auto; text-align: center;
}
.pf-hero-badge {
    display: inline-block;
    background: rgba(212, 160, 23, 0.12);
    border: 1px solid rgba(212, 160, 23, 0.35);
    color: #f0c040;
    font-size: 0.65rem; font-weight: 700; letter-spacing: 0.15em;
    padding: 5px 16px; border-radius: 20px;
    margin-bottom: 16px;
    box-shadow: 0 0 15px rgba(212,160,23,0.1);
    animation: pfBadgeGlow 3s ease-in-out infinite;
}

@keyframes pfBadgeGlow {
    0%, 100% { box-shadow: 0 0 15px rgba(212,160,23,0.1); }
    50% { box-shadow: 0 0 25px rgba(212,160,23,0.2); }
}

.pf-hero-title {
    font-size: 2.8rem; font-weight: 900; letter-spacing: -0.04em;
    color: #fff; margin: 0 0 10px; line-height: 1.1;
    text-shadow: 0 0 40px rgba(212,160,23,0.15);
}
.pf-hero-accent {
    background: linear-gradient(135deg, #d4a017 0%, #f0c040 40%, #d4a017 80%, #f0c040 100%);
    background-size: 200% 100%;
    -webkit-background-clip: text; -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: pfGoldShimmer 4s ease-in-out infinite;
}

@keyframes pfGoldShimmer {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

.pf-hero-sub {
    font-size: 0.95rem; color: rgba(255,255,255,0.55);
    max-width: 480px; margin: 0 auto 28px; line-height: 1.5;
}
.pf-hero-features {
    display: flex; justify-content: center; gap: 12px; flex-wrap: wrap;
}
.pf-hero-feat {
    display: flex; align-items: center; gap: 7px;
    background: rgba(212,160,23,0.04);
    border: 1px solid rgba(212,160,23,0.12);
    padding: 8px 16px; border-radius: 10px;
    font-size: 0.75rem; color: rgba(255,255,255,0.7);
    backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
    transition: all 0.3s ease;
}
.pf-hero-feat:hover {
    background: rgba(212,160,23,0.08);
    border-color: rgba(212,160,23,0.25);
    color: rgba(255,255,255,0.9);
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0,0,0,0.3);
}
.pf-hero-feat-icon { font-size: 0.9rem; }

@media (max-width: 640px) {
    .pf-hero { padding: 36px 16px 28px; }
    .pf-hero-title { font-size: 2.2rem; }
    .pf-hero-sub { font-size: 0.85rem; }
    .pf-hero-features { gap: 8px; }
    .pf-hero-feat { padding: 5px 10px; font-size: 0.7rem; }
}
@media (max-width: 380px) {
    .pf-hero-title { font-size: 1.8rem; }
    .pf-hero-features { gap: 6px; }
    .pf-hero-feat { padding: 4px 8px; font-size: 0.65rem; }
}

.pf-main {
    max-width: 900px;
    margin: 24px auto 40px;
    padding: 0 16px;
}

/* ── AUTH GATE ── */
.pf-auth-gate {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 60vh;
}

.pf-auth-card {
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 48px 40px;
    text-align: center;
    max-width: 420px;
    width: 100%;
}

.pf-auth-icon {
    font-size: 3rem;
    margin-bottom: 12px;
}

.pf-auth-title {
    font-size: 1.8rem;
    font-weight: 800;
    letter-spacing: -0.03em;
    color: var(--text-primary);
    margin: 0 0 8px;
}

.pf-auth-desc {
    font-size: 0.85rem;
    color: var(--text-muted);
    line-height: 1.5;
    margin: 0 0 24px;
}

.pf-auth-form {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.pf-auth-status {
    margin-top: 12px;
    font-size: 0.82rem;
    min-height: 20px;
}

.pf-auth-note {
    margin-top: 16px;
    font-size: 0.72rem;
    color: var(--text-muted);
    opacity: 0.7;
}

/* OTP Form */
.pf-otp-form {
    display: flex;
    flex-direction: column;
    gap: 10px;
    align-items: center;
}

.pf-otp-msg {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin: 0 0 4px;
    line-height: 1.5;
}

.pf-otp-input {
    text-align: center;
    font-size: 1.6rem;
    font-weight: 700;
    letter-spacing: 8px;
    max-width: 220px;
    padding: 14px 16px;
}

.pf-otp-actions {
    display: flex;
    gap: 12px;
    margin-top: 4px;
}

/* ── INPUTS & BUTTONS ── */
.pf-input {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: 'Inter', system-ui, sans-serif;
    font-size: 0.88rem;
    padding: 12px 14px;
    outline: none;
    transition: border-color 0.15s;
    width: 100%;
    box-sizing: border-box;
}

.pf-input:focus {
    border-color: var(--green);
}

.pf-input::placeholder {
    color: var(--text-muted);
    opacity: 0.6;
}

.pf-btn-primary {
    background: var(--green);
    color: #000;
    font-weight: 700;
    font-size: 0.88rem;
    padding: 12px 20px;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-family: 'Inter', system-ui, sans-serif;
    transition: background 0.15s, transform 0.1s;
}

.pf-btn-primary:hover {
    background: #34d399;
}

.pf-btn-primary:active {
    transform: scale(0.98);
}

.pf-btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.pf-btn-secondary {
    background: rgba(255,255,255,0.06);
    color: var(--text-primary);
    font-weight: 600;
    font-size: 0.82rem;
    padding: 10px 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-family: 'Inter', system-ui, sans-serif;
    transition: background 0.15s;
}

.pf-btn-secondary:hover {
    background: rgba(255,255,255,0.1);
}

.pf-btn-ghost {
    background: none;
    color: var(--text-muted);
    font-weight: 500;
    font-size: 0.78rem;
    padding: 8px 12px;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-family: 'Inter', system-ui, sans-serif;
    transition: color 0.15s, border-color 0.15s;
}

.pf-btn-ghost:hover {
    color: var(--text-primary);
    border-color: var(--border);
}

/* ── STATS BAR ── */
/* ── MODE TABS (Portfolio / Watchlist) ── */
.pf-mode-tabs {
    display: inline-flex;
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 3px;
    gap: 2px;
    margin-bottom: 16px;
}
.pf-mode-tab {
    background: transparent;
    border: none;
    padding: 8px 18px;
    border-radius: 8px;
    color: var(--text-muted);
    font-size: 0.85rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.15s;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    letter-spacing: -0.01em;
}
.pf-mode-tab:hover { color: var(--text-primary); background: rgba(255,255,255,0.03); }
.pf-mode-tab.active {
    background: #d97706;
    color: #fff;
}
.pf-mode-tab-count {
    background: rgba(255,255,255,0.12);
    color: inherit;
    font-size: 0.7rem;
    font-weight: 800;
    padding: 1px 8px;
    border-radius: 999px;
    min-width: 22px;
    text-align: center;
}
.pf-mode-tab.active .pf-mode-tab-count {
    background: rgba(0,0,0,0.25);
}

/* Add modal — dual CTA row (Portfolio / Watchlist) */
.pf-add-btn-row {
    display: grid;
    grid-template-columns: 1.4fr 1fr;
    gap: 10px;
    margin-top: 4px;
}
.pf-add-btn-row .pf-btn-add {
    width: 100%;
}

/* Subtle "watching" cue on card rows when viewing watchlist */
.pf-card-item.is-watched {
    border-left: 3px solid #d97706;
}
.pf-card-item-watch-label {
    font-size: 0.62rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #d97706;
    margin-top: 4px;
}

.pf-stats-bar {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    margin-bottom: 20px;
}

.pf-stat {
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 16px;
    text-align: center;
}

.pf-stat-label {
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 4px;
}

.pf-stat-value {
    font-size: 1.3rem;
    font-weight: 800;
    color: var(--text-primary);
    letter-spacing: -0.03em;
}

.pf-stat-value.positive { color: var(--green); }
.pf-stat-value.negative { color: var(--red); }

/* ── GOAL TRACKER ── */
.pf-goal-bar {
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 14px 18px;
    margin-bottom: 20px;
}
.pf-goal-row {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 10px;
}
.pf-goal-label {
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    flex-shrink: 0;
}
.pf-goal-numbers {
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--text-primary);
    flex: 1;
    min-width: 120px;
}
.pf-goal-numbers .pf-goal-percent {
    color: #d97706;
    font-weight: 800;
    margin-left: 6px;
}
.pf-goal-numbers .pf-goal-hit {
    color: var(--green);
}
.pf-goal-controls {
    display: flex;
    gap: 6px;
    align-items: center;
    flex-wrap: wrap;
}
.pf-goal-input {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 0.82rem;
    padding: 6px 10px;
    width: 120px;
}
.pf-goal-input:focus {
    outline: none;
    border-color: #d97706;
}
.pf-goal-btn {
    background: #d97706;
    color: #fff;
    border: none;
    padding: 6px 14px;
    border-radius: var(--radius-sm);
    font-size: 0.78rem;
    font-weight: 700;
    cursor: pointer;
}
.pf-goal-btn:hover { background: #b45309; }
.pf-goal-btn.pf-goal-btn-ghost {
    background: transparent;
    color: var(--text-muted);
    border: 1px solid var(--border);
}
.pf-goal-btn.pf-goal-btn-ghost:hover {
    color: var(--red);
    border-color: var(--red);
}
.pf-goal-progress-wrap {
    height: 6px;
    background: var(--bg-secondary);
    border-radius: 3px;
    overflow: hidden;
}
.pf-goal-progress-bar {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #d97706 0%, #f59e0b 100%);
    border-radius: 3px;
    transition: width 0.4s ease;
}
.pf-goal-progress-bar.hit {
    background: linear-gradient(90deg, #059669 0%, #10b981 100%);
}

/* ── INSIGHTS ROW (allocation + movers) ── */
.pf-insights-row {
    display: grid;
    grid-template-columns: minmax(300px, 1fr) 2fr;
    gap: 16px;
    margin-bottom: 20px;
    align-items: stretch;
}

.pf-alloc-card {
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 16px 18px;
    display: flex;
    flex-direction: column;
}
.pf-alloc-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 14px;
    flex-wrap: wrap;
}
.pf-alloc-tabs {
    display: inline-flex;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 2px;
    gap: 2px;
}
.pf-alloc-tab {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 0.7rem;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.12s;
}
.pf-alloc-tab:hover { color: var(--text-primary); background: rgba(255,255,255,0.04); }
.pf-alloc-tab.active { background: #d97706; color: #fff; }

.pf-alloc-body {
    display: flex;
    gap: 16px;
    align-items: center;
    flex: 1;
    min-height: 0;
}
.pf-alloc-donut {
    position: relative;
    width: 160px;
    height: 160px;
    flex-shrink: 0;
}
.pf-alloc-donut canvas {
    width: 100%;
    height: 100%;
    display: block;
}
.pf-alloc-center {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    pointer-events: none;
}
.pf-alloc-center-label {
    font-size: 0.62rem;
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}
.pf-alloc-center-value {
    font-size: 1.15rem;
    font-weight: 800;
    color: var(--text-primary);
    letter-spacing: -0.02em;
}
.pf-alloc-legend {
    list-style: none;
    padding: 0;
    margin: 0;
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 0.78rem;
}
.pf-alloc-legend li {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-secondary);
    overflow: hidden;
}
.pf-alloc-swatch {
    width: 10px;
    height: 10px;
    border-radius: 2px;
    flex-shrink: 0;
}
.pf-alloc-legend-name {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--text-primary);
    font-weight: 600;
}
.pf-alloc-legend-val {
    font-weight: 700;
    color: var(--text-primary);
    flex-shrink: 0;
}
.pf-alloc-legend-pct {
    color: var(--text-muted);
    flex-shrink: 0;
    font-size: 0.72rem;
    min-width: 42px;
    text-align: right;
}
.pf-alloc-empty {
    color: var(--text-muted);
    font-size: 0.78rem;
    padding: 20px;
    text-align: center;
    width: 100%;
}

/* ── TOP GAINERS / LOSERS ── */
.pf-movers-section {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
}
.pf-movers-col {
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 16px 18px;
}
.pf-movers-title {
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0 0 12px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.pf-movers-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.pf-mover-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.15s;
}
.pf-mover-row:hover {
    border-color: rgba(217,119,6,0.5);
    background: rgba(217,119,6,0.04);
}
.pf-mover-thumb {
    width: 32px;
    height: 44px;
    flex-shrink: 0;
    background: rgba(255,255,255,0.05);
    border-radius: 3px;
    overflow: hidden;
}
.pf-mover-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.pf-mover-info {
    flex: 1;
    min-width: 0;
}
.pf-mover-name {
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.pf-mover-set {
    font-size: 0.68rem;
    color: var(--text-muted);
    margin-top: 2px;
}
.pf-mover-change {
    text-align: right;
    flex-shrink: 0;
}
.pf-mover-change-pct {
    font-size: 0.88rem;
    font-weight: 800;
    letter-spacing: -0.02em;
}
.pf-mover-change-pct.positive { color: var(--green); }
.pf-mover-change-pct.negative { color: var(--red); }
.pf-mover-change-dollar {
    font-size: 0.7rem;
    color: var(--text-muted);
    margin-top: 2px;
}
.pf-movers-empty {
    font-size: 0.78rem;
    color: var(--text-muted);
    text-align: center;
    padding: 16px 12px;
}

/* ── ACTIONS ── */
.pf-actions {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
    margin-bottom: 20px;
}

/* ── FILTER BAR ── */
.pf-filter-bar {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
    margin-bottom: 14px;
}

.pf-filter-search {
    flex: 1;
    min-width: 160px;
    padding: 8px 12px;
    font-size: 0.82rem;
}

.pf-filter-select {
    width: auto;
    min-width: 120px;
    padding: 8px 10px;
    font-size: 0.82rem;
}

.pf-group-toggle {
    font-size: 0.78rem;
    padding: 8px 12px;
    white-space: nowrap;
}

.pf-group-toggle.active {
    background: rgba(16, 185, 129, 0.15);
    color: var(--green);
    border-color: var(--green);
}

/* ── SET GROUPS ── */
.pf-set-group {
    margin-bottom: 20px;
}

.pf-set-group-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    margin-bottom: 6px;
}

.pf-set-group-name {
    font-weight: 700;
    font-size: 0.85rem;
    color: var(--text-primary);
}

.pf-set-group-meta {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.pf-set-completion {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.72rem;
    color: var(--text-muted);
    flex: 1;
    margin: 0 12px;
}

.pf-completion-bar {
    flex: 1;
    max-width: 100px;
    height: 4px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 2px;
    overflow: hidden;
}

.pf-completion-fill {
    height: 100%;
    background: var(--green);
    border-radius: 2px;
    transition: width 0.5s ease;
}

/* ── PUBLIC VIEW ── */
.pf-public-header {
    text-align: center;
    margin-bottom: 20px;
    padding: 16px;
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
}

/* ── CONDITION BADGES ── */
.pf-condition-badge {
    display: inline-block;
    font-size: 0.65rem;
    font-weight: 700;
    padding: 1px 5px;
    border-radius: 3px;
    margin-left: 6px;
    vertical-align: middle;
}

.pf-cond-lp { background: rgba(217, 119, 6, 0.2); color: #d97706; }
.pf-cond-mp { background: rgba(234, 88, 12, 0.2); color: #ea580c; }
.pf-cond-hp { background: rgba(220, 38, 38, 0.2); color: #dc2626; }
.pf-cond-dmg { background: rgba(220, 38, 38, 0.3); color: #ef4444; }
.pf-cond-psa { background: rgba(59, 130, 246, 0.2); color: #3b82f6; font-weight: 700; }

/* ── PORTFOLIO V2 BADGES (variant + multi-grader) ── */
.pf-variant-badge {
    display: inline-block;
    font-size: 0.62rem;
    font-weight: 700;
    padding: 1px 5px;
    border-radius: 3px;
    margin-left: 6px;
    vertical-align: middle;
    background: rgba(168, 85, 247, 0.2);
    color: #a855f7;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}
.pf-grade-badge {
    display: inline-block;
    font-size: 0.65rem;
    font-weight: 800;
    padding: 1px 6px;
    border-radius: 3px;
    margin-left: 6px;
    vertical-align: middle;
    text-transform: uppercase;
    letter-spacing: 0.02em;
}
.pf-grade-psa { background: rgba(59, 130, 246, 0.22); color: #3b82f6; }
.pf-grade-bgs { background: rgba(245, 158, 11, 0.22); color: #f59e0b; }
.pf-grade-cgc { background: rgba(168, 85, 247, 0.22); color: #a855f7; }
.pf-grade-sgc { background: rgba(220, 38, 38, 0.22); color: #ef4444; }

/* Variant picker (matches existing pf-condition-tabs spacing) */
.pf-variant-picker {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 10px;
}
/* Grader sub-tabs inside the graded picker */
.pf-grader-tabs {
    display: flex;
    gap: 6px;
    margin-bottom: 10px;
    flex-wrap: wrap;
}
.pf-grader-tab {
    flex: 1 1 0;
    min-width: 50px;
    padding: 6px 10px;
    background: rgba(255,255,255,0.04);
    border: 1px solid var(--border);
    border-radius: var(--radius-md, 6px);
    color: var(--text-secondary);
    font-size: 0.78rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.15s;
}
.pf-grader-tab:hover { background: rgba(255,255,255,0.08); }
.pf-grader-tab.active {
    background: var(--gold, #d97706);
    color: #fff;
    border-color: var(--gold, #d97706);
}
.pf-grade-values {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
}

/* ── ANALYTICS PANEL ── */
.pf-analytics {
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px;
    margin-bottom: 16px;
}

.pf-analytics-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
}

.pf-metric {
    text-align: center;
}

.pf-metric-label {
    font-size: 0.7rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 4px;
}

.pf-metric-value {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.pf-metric-value .positive { color: var(--green); }
.pf-metric-value .negative { color: var(--red); }

/* ── AI SCAN BADGE ── */
.pf-ai-badge {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.15), rgba(168, 85, 247, 0.15));
    color: #a78bfa;
    font-size: 0.78rem;
    font-weight: 600;
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    margin-bottom: 10px;
    text-align: center;
}

/* ── CARD LIST ── */
.pf-card-list-header {
    display: flex;
    gap: 8px;
    margin-bottom: 10px;
    padding: 0 4px;
}

.pf-sort-btn {
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px 10px;
    border-radius: 3px;
    transition: color 0.15s, background 0.15s;
}

.pf-sort-btn:hover {
    color: var(--text-primary);
    background: rgba(255,255,255,0.05);
}

.pf-sort-btn.active {
    color: var(--green);
    background: rgba(16, 185, 129, 0.08);
}

.pf-card-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 32px;
}

.pf-card-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px;
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    transition: background 0.15s;
}

.pf-card-item:hover {
    background: var(--bg-card-hover);
}

.pf-card-item-thumb {
    width: 50px;
    height: 70px;
    border-radius: 3px;
    overflow: hidden;
    flex-shrink: 0;
}

.pf-card-item-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.pf-card-item-info {
    flex: 1;
    min-width: 0;
}

.pf-card-item-name {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.pf-card-item-set {
    font-size: 0.72rem;
    color: var(--text-muted);
    margin-top: 2px;
}

.pf-card-item-qty {
    font-size: 0.68rem;
    color: var(--text-muted);
    margin-top: 4px;
}

.pf-card-item-prices {
    text-align: right;
    flex-shrink: 0;
}

.pf-card-item-current {
    font-size: 0.88rem;
    font-weight: 700;
    color: var(--text-primary);
}

.pf-card-item-gain {
    font-size: 0.72rem;
    font-weight: 600;
    margin-top: 2px;
}

.pf-card-item-gain.positive { color: var(--green); }
.pf-card-item-gain.negative { color: var(--red); }

.pf-card-item-value {
    font-size: 0.68rem;
    color: var(--text-muted);
    margin-top: 2px;
}

.pf-card-item-actions {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex-shrink: 0;
}

.pf-card-item-actions button {
    background: none;
    border: 1px solid var(--border);
    border-radius: 3px;
    color: var(--text-muted);
    font-size: 0.65rem;
    padding: 3px 8px;
    cursor: pointer;
    font-family: 'Inter', system-ui, sans-serif;
    transition: color 0.15s, border-color 0.15s;
}

.pf-card-item-actions button:hover {
    color: var(--text-primary);
    border-color: var(--text-muted);
}

.pf-card-item-actions button.remove:hover {
    color: var(--red);
    border-color: var(--red);
}

.pf-empty-state {
    padding: 48px 24px;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.85rem;
}

/* ── VALUE CHART ── */
.pf-chart-section {
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 20px;
}

.pf-chart-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 16px;
}

.pf-chart-header .pf-section-title {
    margin: 0;
    flex-shrink: 0;
}

.pf-chart-range-tabs {
    display: inline-flex;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 3px;
    gap: 2px;
    flex-wrap: wrap;
}

.pf-range-tab {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    padding: 5px 10px;
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.12s;
    min-width: 38px;
}

.pf-range-tab:hover {
    color: var(--text-primary);
    background: rgba(255,255,255,0.04);
}

.pf-range-tab.active {
    background: #d97706;
    color: #fff;
}

.pf-chart-basis-toggle {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--text-muted);
    cursor: pointer;
    user-select: none;
    white-space: nowrap;
}

.pf-chart-basis-toggle input[type="checkbox"] {
    cursor: pointer;
    accent-color: #d97706;
}

.pf-section-title {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0 0 16px;
}

#valueChart,
.pf-value-chart {
    width: 100%;
    height: 260px;
    min-height: 200px;
    overflow: hidden;
    border-radius: 6px;
}

.pf-chart-empty {
    font-size: 0.78rem;
    color: var(--text-muted);
    text-align: center;
    padding: 40px 24px;
    background: var(--bg-secondary);
    border: 1px dashed var(--border);
    border-radius: 6px;
    margin-top: 8px;
}

@media (max-width: 900px) {
    .pf-insights-row { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
    .pf-chart-range-tabs { width: 100%; justify-content: center; }
    .pf-range-tab { flex: 1 0 auto; }
    .pf-chart-basis-toggle { width: 100%; justify-content: center; }
    #valueChart, .pf-value-chart { height: 220px; }
    .pf-movers-section { grid-template-columns: 1fr; }
    .pf-goal-row { gap: 10px; }
    .pf-goal-input { flex: 1; min-width: 100px; }
    .pf-alloc-body { flex-direction: column; gap: 12px; align-items: stretch; }
    .pf-alloc-donut { margin: 0 auto; }
}

/* ── MODALS ── */
.pf-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.75);
    backdrop-filter: blur(4px);
    z-index: 400;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
}

.pf-scan-modal,
.pf-add-modal {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 28px;
    max-width: 500px;
    width: 100%;
    position: relative;
    max-height: 90vh;
    overflow-y: auto;
}

.pf-modal-close {
    position: absolute;
    top: 12px;
    right: 16px;
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 4px;
}

.pf-modal-close:hover {
    color: var(--text-primary);
}

.pf-modal-title {
    font-size: 1.1rem;
    font-weight: 700;
    margin: 0 0 12px;
    color: var(--text-primary);
}

/* ── CAMERA / SCAN ── */
.pf-scan-instructions {
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-bottom: 16px;
}

.pf-camera-container {
    position: relative;
    width: 100%;
    aspect-ratio: 3/4;
    background: #000;
    border-radius: var(--radius-sm);
    overflow: hidden;
    margin-bottom: 12px;
}

.pf-camera-container video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.pf-viewfinder {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 65%;
    aspect-ratio: 2.5/3.5;
    transform: translate(-50%, -50%);
    border: 2px solid var(--green);
    border-radius: 8px;
    pointer-events: none;
    box-shadow: 0 0 0 4000px rgba(0,0,0,0.25);
}

.pf-scan-actions {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-bottom: 12px;
}

.pf-scan-result {
    margin-top: 12px;
}

.pf-scan-result-card {
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 14px;
}

/* ── SCAN CONFIRM ── */
.pf-confirm-card {
    padding: 4px 0;
}

.pf-confirm-header {
    display: flex;
    gap: 14px;
    margin-bottom: 16px;
}

.pf-confirm-img {
    width: 80px;
    height: 112px;
    object-fit: cover;
    border-radius: 6px;
    border: 1px solid var(--border);
    flex-shrink: 0;
}

.pf-confirm-info {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 3px;
}

.pf-confirm-name {
    font-weight: 700;
    font-size: 1rem;
    color: var(--text-primary);
}

.pf-confirm-set {
    font-size: 0.78rem;
    color: var(--text-muted);
}

.pf-confirm-rarity {
    font-size: 0.72rem;
    color: var(--amber);
}

.pf-confirm-price {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--green);
    margin-top: 4px;
}

.pf-confirm-options {
    border-top: 1px solid var(--border);
    padding-top: 14px;
}

.pf-confirm-label {
    display: block;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 6px;
}

.pf-condition-tabs {
    display: flex;
    gap: 0;
    margin-bottom: 10px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    overflow: hidden;
}

.pf-cond-tab {
    flex: 1;
    padding: 7px 0;
    font-size: 0.78rem;
    font-weight: 600;
    background: var(--bg-primary);
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}

.pf-cond-tab.active {
    background: var(--amber);
    color: #000;
}

.pf-cond-picker {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.pf-cond-btn {
    padding: 6px 10px;
    font-size: 0.72rem;
    font-weight: 600;
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.15s;
}

.pf-cond-btn:hover {
    border-color: var(--amber);
}

.pf-cond-btn.active {
    background: var(--amber);
    border-color: var(--amber);
    color: #000;
}

/* ── ADD FORM ── */
.pf-add-form {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.pf-add-row {
    display: flex;
    gap: 10px;
}

/* ── CARD SEARCH ── */
.pf-search-bar {
    margin-bottom: 16px;
}

.pf-search-input {
    font-size: 0.95rem !important;
    padding: 14px 16px !important;
}

.pf-search-hint {
    font-size: 0.72rem;
    color: var(--text-muted);
    opacity: 0.6;
    margin-top: 6px;
}

.pf-search-loading,
.pf-search-empty {
    padding: 24px;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.82rem;
}

.pf-search-results {
    display: flex;
    flex-direction: column;
    gap: 4px;
    max-height: 320px;
    overflow-y: auto;
}

.pf-search-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.15s;
}

.pf-search-card:hover {
    background: rgba(16, 185, 129, 0.04);
    border-color: rgba(16, 185, 129, 0.15);
}

.pf-search-card.selected {
    background: rgba(16, 185, 129, 0.08);
    border-color: var(--green);
}

.pf-search-card-img {
    width: 48px;
    height: 67px;
    object-fit: cover;
    border-radius: 3px;
    flex-shrink: 0;
}

.pf-search-card-info {
    flex: 1;
    min-width: 0;
}

.pf-search-card-name {
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.pf-search-card-set {
    font-size: 0.7rem;
    color: var(--text-muted);
    margin-top: 2px;
}

.pf-search-card-rarity {
    font-size: 0.65rem;
    color: var(--text-muted);
    opacity: 0.7;
    margin-top: 1px;
    text-transform: capitalize;
}

.pf-search-card-price {
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--green);
    flex-shrink: 0;
    white-space: nowrap;
}

/* ── SELECTED CARD DETAIL ── */
.pf-selected-card {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
}

.pf-selected-preview {
    display: flex;
    gap: 16px;
    margin-bottom: 16px;
}

.pf-selected-img {
    width: 120px;
    border-radius: 6px;
    flex-shrink: 0;
}

.pf-selected-info {
    flex: 1;
}

.pf-selected-name {
    font-size: 1.05rem;
    font-weight: 800;
    color: var(--text-primary);
    letter-spacing: -0.02em;
}

.pf-selected-set {
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-top: 4px;
}

.pf-selected-rarity {
    font-size: 0.72rem;
    color: var(--text-muted);
    opacity: 0.7;
    margin-top: 2px;
    text-transform: capitalize;
}

.pf-selected-price {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--green);
    margin-top: 8px;
}

.pf-selected-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.pf-field {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.pf-field-label {
    font-size: 0.68rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.pf-btn-add {
    width: 100%;
    margin-top: 4px;
}

/* ── SCAN RESULTS (visual) ── */
.pf-scan-matches {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.pf-scan-match {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.15s;
}

.pf-scan-match:hover {
    background: rgba(16, 185, 129, 0.06);
    border-color: rgba(16, 185, 129, 0.2);
}

.pf-scan-match-img {
    width: 44px;
    height: 61px;
    object-fit: cover;
    border-radius: 3px;
    flex-shrink: 0;
}

.pf-scan-match-info {
    flex: 1;
    min-width: 0;
}

.pf-scan-match-name {
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--text-primary);
}

.pf-scan-match-set {
    font-size: 0.7rem;
    color: var(--text-muted);
    margin-top: 2px;
}

.pf-scan-match-rarity {
    font-size: 0.65rem;
    color: var(--text-muted);
    opacity: 0.7;
    margin-top: 1px;
    text-transform: capitalize;
}

.pf-scan-match-price {
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--green);
    flex-shrink: 0;
}

.pf-scan-hint {
    font-size: 0.68rem;
    color: var(--text-muted);
    text-align: center;
    margin-top: 10px;
    opacity: 0.7;
}

/* ── HEADER AUTH ── */
.pf-user-email {
    font-size: 0.72rem;
    color: var(--text-muted);
}

.pf-logout-btn {
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--text-muted);
    background: none;
    border: 1px solid var(--border);
    border-radius: 3px;
    padding: 4px 10px;
    cursor: pointer;
    font-family: 'Inter', system-ui, sans-serif;
}

.pf-logout-btn:hover {
    color: var(--red);
    border-color: var(--red);
}

/* ── QUICK PICKS ── */
.pf-quick-picks {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 8px 0;
}

.pf-quick-pick {
    display: inline-flex;
    align-items: center;
    padding: 8px 16px;
    font-size: 0.8rem;
    font-weight: 600;
    font-family: 'Inter', system-ui, sans-serif;
    color: var(--text-primary);
    background: rgba(255,255,255,0.04);
    border: 1px solid var(--border);
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.15s ease;
    white-space: nowrap;
}

.pf-quick-pick:hover {
    background: rgba(16, 185, 129, 0.08);
    border-color: var(--green);
    color: var(--green);
}

/* ── NAME SUGGESTIONS (autocomplete) ── */
.pf-name-suggestions {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.pf-name-pill {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    font-family: 'Inter', system-ui, sans-serif;
    color: var(--text-primary);
    background: rgba(255,255,255,0.02);
    border: 1px solid var(--border);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.15s ease;
    text-align: left;
    width: 100%;
}

.pf-name-pill:hover {
    background: rgba(16, 185, 129, 0.06);
    border-color: rgba(16, 185, 129, 0.3);
}

.pf-pill-img {
    width: 32px;
    height: 45px;
    object-fit: cover;
    border-radius: 2px;
    flex-shrink: 0;
}

.pf-pill-name {
    font-size: 0.85rem;
    font-weight: 700;
    flex: 1;
}

.pf-pill-count {
    font-size: 0.68rem;
    color: var(--text-muted);
    opacity: 0.6;
    flex-shrink: 0;
}

.pf-suggestions-hint {
    font-size: 0.68rem;
    color: var(--text-muted);
    text-align: center;
    margin-top: 10px;
    opacity: 0.5;
}

/* ── SCAN MANUAL INPUT ── */
.pf-scan-manual {
    margin-top: 12px;
}

.pf-scan-divider {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 10px;
}

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

.pf-scan-divider span {
    font-size: 0.7rem;
    color: var(--text-muted);
    white-space: nowrap;
}

.pf-scan-code-row {
    display: flex;
    gap: 8px;
    margin-bottom: 8px;
}

.pf-scan-code-row .pf-input {
    flex: 1;
}

.pf-scan-name-btn {
    width: 100%;
    text-align: center;
    font-size: 0.75rem;
    padding: 8px;
}

/* ── RESPONSIVE ── */
@media (max-width: 768px) {
    .pf-stats-bar { grid-template-columns: repeat(2, 1fr); gap: 10px; }
    .pf-analytics-grid { grid-template-columns: repeat(2, 1fr); }
    .pf-card-item-actions button { min-height: 44px; padding: 6px 12px; font-size: 0.72rem; }
    .pf-cond-tab { min-height: 44px; }
    .pf-cond-btn { min-height: 44px; padding: 8px 12px; }
    .pf-search-results { max-height: 260px; }
}

@media (max-width: 640px) {
    .pf-stat-value { font-size: 1.1rem; }
    .pf-actions { flex-direction: column; align-items: stretch; }
    .pf-card-item { flex-wrap: wrap; }
    .pf-auth-card { padding: 32px 24px; }
    .pf-scan-modal, .pf-add-modal { padding: 20px; margin: 8px; }
    .pf-filter-bar { flex-direction: column; }
    .pf-filter-search, .pf-filter-select { width: 100%; }
    .pf-analytics-grid { grid-template-columns: repeat(2, 1fr); }
    .pf-card-list-header { overflow-x: auto; flex-wrap: nowrap; }
    .pf-sort-btn { white-space: nowrap; min-height: 44px; }
    .pf-group-toggle { width: 100%; text-align: center; }
    .pf-set-group-header { flex-direction: column; align-items: flex-start; gap: 4px; }
    .pf-set-completion { margin: 4px 0 0; }
}

@media (max-width: 480px) {
    .pf-main { padding: 0 12px; }
    .pf-stat { padding: 12px; }
    .pf-stat-value { font-size: 1rem; }
    .pf-stat-label { font-size: max(0.65rem, 10px); }
    .pf-card-item { gap: 10px; padding: 10px; }
    .pf-card-item-thumb { width: 40px; height: 56px; }
    .pf-card-item-name { font-size: max(0.8rem, 12px); }
    .pf-card-item-set { font-size: max(0.68rem, 10px); }
    .pf-card-item-current { font-size: max(0.82rem, 12px); }
    .pf-card-item-gain { font-size: max(0.68rem, 10px); }
    .pf-actions { gap: 8px; }
    .pf-btn-primary, .pf-btn-secondary { width: 100%; text-align: center; min-height: 44px; }
    .pf-camera-container { aspect-ratio: 3/4; }
    .pf-scan-modal, .pf-add-modal { padding: 16px; margin: 4px; max-height: 95vh; }
    .pf-modal-title { font-size: 1rem; }
    .pf-scan-actions { flex-direction: column; }
    .pf-scan-actions .pf-btn-primary,
    .pf-scan-actions .pf-btn-secondary { width: 100%; min-height: 44px; }
    .pf-confirm-img { width: 64px; height: 90px; }
    .pf-confirm-name { font-size: 0.9rem; }
    .pf-analytics { padding: 14px; }
    .pf-analytics-grid { gap: 10px; }
    .pf-metric-label { font-size: max(0.65rem, 10px); }
    .pf-metric-value { font-size: max(0.78rem, 11px); }
    .pf-selected-preview { flex-direction: column; align-items: center; text-align: center; }
    .pf-selected-img { width: 100px; }
    .pf-quick-pick { padding: 6px 12px; font-size: 0.75rem; }
}

@media (max-width: 360px) {
    .pf-main { padding: 0 8px; }
    .pf-stats-bar { grid-template-columns: 1fr; gap: 6px; }
    .pf-stat { padding: 10px; }
    .pf-auth-card { padding: 24px 16px; }
    .pf-auth-title { font-size: 1.4rem; }
    .pf-otp-input { font-size: 1.3rem; letter-spacing: 6px; max-width: 180px; }
    .pf-card-item { flex-direction: column; align-items: flex-start; }
    .pf-card-item-actions { flex-direction: row; width: 100%; }
    .pf-card-item-actions button { flex: 1; }
    .pf-cond-picker { gap: 4px; }
    .pf-cond-btn { padding: 6px 8px; font-size: max(0.68rem, 10px); }
    .pf-scan-code-row { flex-direction: column; }
}

/* ── PROGRESSIVE PRO BANNER ── */
.pf-pro-banner {
    margin: 0 0 16px;
    padding: 14px 18px;
    border-radius: 12px;
    border: 1px solid;
    display: block;
}
.pf-pro-banner-soft {
    background: linear-gradient(135deg, #1a1a2e 0%, #2d1f0e 100%);
    border-color: rgba(217, 119, 6, 0.25);
}
.pf-pro-banner-warning {
    background: linear-gradient(135deg, #1a1a2e 0%, #3d2a0e 100%);
    border-color: rgba(217, 119, 6, 0.7);
    box-shadow: 0 0 0 1px rgba(217, 119, 6, 0.15);
}
.pf-pro-banner-urgent {
    background: linear-gradient(135deg, #2d1a1a 0%, #3d2a0e 100%);
    border-color: #d97706;
    box-shadow: 0 0 24px rgba(217, 119, 6, 0.25);
}
.pf-pro-banner-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
}
.pf-pro-banner-text { flex: 1; min-width: 200px; }
.pf-pro-banner-heading {
    font-size: 1rem;
    font-weight: 800;
    color: #d97706;
    margin-bottom: 4px;
    letter-spacing: -0.01em;
}
.pf-pro-banner-urgent .pf-pro-banner-heading { color: #fff; }
.pf-pro-banner-sub {
    font-size: 0.78rem;
    color: var(--text-muted);
    line-height: 1.5;
}
.pf-pro-banner-cta {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}
.pf-pro-banner-price {
    font-size: 1.1rem;
    font-weight: 800;
    color: #fff;
}
.pf-pro-banner-price-sub {
    font-size: 0.65rem;
    font-weight: 400;
    color: var(--text-muted);
}
.pf-pro-banner-btn {
    background: #d97706;
    color: #fff;
    border: none;
    padding: 8px 18px;
    border-radius: 8px;
    font-size: 0.8rem;
    font-weight: 700;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.15s;
}
.pf-pro-banner-btn:hover { background: #b45309; }
.pf-pro-banner-urgent .pf-pro-banner-btn {
    animation: pfProPulse 1.8s ease-in-out infinite;
}
@keyframes pfProPulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(217, 119, 6, 0.6); }
    50%      { box-shadow: 0 0 0 8px rgba(217, 119, 6, 0); }
}

/* ── CARD DETAIL DRAWER ── */
.pf-card-item { cursor: pointer; transition: background 0.15s; }
.pf-card-item:hover { background: rgba(255, 255, 255, 0.02); }

.pf-drawer {
    position: fixed;
    inset: 0;
    z-index: 500;
    pointer-events: none;
}
.pf-drawer.is-open { pointer-events: auto; }

.pf-drawer-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(4px);
    opacity: 0;
    transition: opacity 0.2s ease;
    cursor: pointer;
}
.pf-drawer.is-open .pf-drawer-backdrop { opacity: 1; }

.pf-drawer-panel {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    width: 520px;
    max-width: 100vw;
    background: var(--bg-card);
    border-left: 1px solid var(--border);
    transform: translateX(100%);
    transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: -8px 0 32px rgba(0, 0, 0, 0.4);
}
.pf-drawer.is-open .pf-drawer-panel { transform: translateX(0); }

.pf-drawer-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
    background: var(--bg-card);
}
.pf-drawer-title {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    padding-right: 12px;
}
.pf-drawer-close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.6rem;
    cursor: pointer;
    padding: 4px 10px;
    line-height: 1;
    border-radius: 6px;
    flex-shrink: 0;
}
.pf-drawer-close:hover { color: var(--text-primary); background: rgba(255,255,255,0.05); }

.pf-drawer-body {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
}

.pf-drawer-section { margin-bottom: 24px; }
.pf-drawer-section-title {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    margin: 0 0 12px;
}

.pf-drawer-hero {
    display: flex;
    gap: 16px;
    margin-bottom: 20px;
}
.pf-drawer-hero-img {
    width: 140px;
    flex-shrink: 0;
    border-radius: var(--radius-md);
    overflow: hidden;
    background: rgba(255,255,255,0.03);
    border: 1px solid var(--border);
    align-self: flex-start;
}
.pf-drawer-hero-img img { width: 100%; display: block; }
.pf-drawer-hero-info { flex: 1; min-width: 0; }
.pf-drawer-hero-name {
    font-size: 1.2rem;
    font-weight: 800;
    color: var(--text-primary);
    line-height: 1.2;
    margin: 0 0 6px;
}
.pf-drawer-hero-set {
    font-size: 0.78rem;
    color: var(--text-muted);
    margin: 0 0 4px;
}
.pf-drawer-hero-cond {
    display: inline-block;
    padding: 3px 10px;
    background: rgba(217, 119, 6, 0.12);
    border: 1px solid rgba(217, 119, 6, 0.6);
    color: #d97706;
    font-size: 0.7rem;
    font-weight: 700;
    border-radius: 4px;
    margin-top: 6px;
}

.pf-drawer-position-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    margin-bottom: 12px;
}
.pf-drawer-pos-cell {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 10px 8px;
    text-align: center;
}
.pf-drawer-pos-label {
    font-size: 0.62rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    margin-bottom: 4px;
}
.pf-drawer-pos-value {
    font-size: 1rem;
    font-weight: 800;
    color: var(--text-primary);
}
.pf-drawer-pos-value.positive { color: var(--green, #10b981); }
.pf-drawer-pos-value.negative { color: var(--red, #ef4444); }
.pf-drawer-pos-sub {
    font-size: 0.65rem;
    color: var(--text-muted);
    margin-top: 2px;
}
.pf-drawer-pos-sub.positive { color: var(--green, #10b981); }
.pf-drawer-pos-sub.negative { color: var(--red, #ef4444); }

.pf-drawer-meta-row {
    font-size: 0.78rem;
    color: var(--text-muted);
    line-height: 1.6;
    margin-top: 10px;
}
.pf-drawer-meta-row strong { color: var(--text-primary); font-weight: 700; }
.pf-drawer-meta-row .positive { color: var(--green, #10b981); }
.pf-drawer-meta-row .negative { color: var(--red, #ef4444); }

#pfDrawerChart {
    width: 100%;
    height: 200px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    overflow: hidden;
}
.pf-drawer-chart-empty {
    font-size: 0.78rem;
    color: var(--text-muted);
    text-align: center;
    padding: 60px 20px;
    line-height: 1.5;
}

.pf-drawer-context-list {
    list-style: none;
    padding: 0;
    margin: 0;
    font-size: 0.82rem;
    color: var(--text-secondary);
}
.pf-drawer-context-list li {
    padding: 8px 0;
    border-bottom: 1px dashed var(--border);
}
.pf-drawer-context-list li:last-child { border-bottom: none; }
.pf-drawer-context-list strong { color: var(--text-primary); font-weight: 700; }

.pf-drawer-links {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
.pf-drawer-link-btn {
    flex: 1 1 calc(33% - 6px);
    text-align: center;
    padding: 10px 12px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 0.78rem;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.15s;
    white-space: nowrap;
}
.pf-drawer-link-btn:hover {
    background: rgba(217, 119, 6, 0.08);
    border-color: rgba(217, 119, 6, 0.6);
}

/* Drawer — Price alerts */
.pf-drawer-alerts { display: flex; flex-direction: column; gap: 8px; }
.pf-drawer-alert-loading {
    font-size: 0.78rem;
    color: var(--text-muted);
    text-align: center;
    padding: 12px;
}
.pf-alert-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    background: rgba(217, 119, 6, 0.08);
    border: 1px solid rgba(217, 119, 6, 0.4);
    border-radius: var(--radius-sm);
    font-size: 0.82rem;
    color: var(--text-primary);
}
.pf-alert-dir {
    font-size: 1.1rem;
    font-weight: 800;
    min-width: 18px;
    text-align: center;
}
.pf-alert-dir.below { color: #ef4444; }
.pf-alert-dir.above { color: #10b981; }
.pf-alert-text { flex: 1; min-width: 0; }
.pf-alert-del, .pf-alert-del-small {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.2rem;
    cursor: pointer;
    padding: 2px 8px;
    border-radius: 4px;
}
.pf-alert-del:hover, .pf-alert-del-small:hover { color: var(--red); background: rgba(239, 68, 68, 0.1); }
.pf-alert-del-small { font-size: 1rem; }

.pf-alert-empty {
    font-size: 0.78rem;
    color: var(--text-muted);
    text-align: center;
    padding: 12px;
    background: var(--bg-secondary);
    border: 1px dashed var(--border);
    border-radius: var(--radius-sm);
}

.pf-alert-triggered {
    margin-top: 4px;
    padding: 10px 12px;
    background: var(--bg-secondary);
    border-radius: var(--radius-sm);
}
.pf-alert-triggered-label {
    font-size: 0.68rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 6px;
}
.pf-alert-trig-row {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.78rem;
    color: var(--text-secondary);
    padding: 4px 0;
}
.pf-alert-trig-row:first-of-type ~ .pf-alert-trig-row { border-top: 1px dashed var(--border); margin-top: 2px; padding-top: 6px; }
.pf-alert-rearm {
    margin-left: auto;
    background: transparent;
    color: #d97706;
    border: 1px solid rgba(217, 119, 6, 0.5);
    padding: 2px 10px;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 700;
    cursor: pointer;
}
.pf-alert-rearm:hover { background: rgba(217, 119, 6, 0.1); }

.pf-alert-form {
    display: flex;
    gap: 6px;
    margin-top: 6px;
    flex-wrap: wrap;
}
.pf-alert-select,
.pf-alert-price {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 0.78rem;
    padding: 8px 10px;
}
.pf-alert-select { flex: 2 1 140px; }
.pf-alert-price { flex: 1 1 80px; min-width: 80px; }
.pf-alert-save {
    background: #d97706;
    color: #fff;
    border: none;
    padding: 8px 14px;
    border-radius: var(--radius-sm);
    font-size: 0.78rem;
    font-weight: 700;
    cursor: pointer;
    flex-shrink: 0;
}
.pf-alert-save:hover { background: #b45309; }
.pf-alert-hint {
    font-size: 0.68rem;
    color: var(--text-muted);
    margin-top: 6px;
    line-height: 1.4;
}

.pf-drawer-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}
.pf-drawer-action-btn {
    flex: 1 1 auto;
    padding: 10px 12px;
    border: 1px solid var(--border);
    background: transparent;
    color: var(--text-primary);
    font-size: 0.78rem;
    font-weight: 600;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: background 0.15s;
}
.pf-drawer-action-btn:hover { background: rgba(255,255,255,0.04); }
.pf-drawer-action-btn.danger { color: var(--red, #ef4444); border-color: rgba(239, 68, 68, 0.5); }
.pf-drawer-action-btn.danger:hover { background: rgba(239, 68, 68, 0.08); }

@media (max-width: 640px) {
    .pf-drawer-panel { width: 100%; box-shadow: none; }
    .pf-drawer-hero { flex-direction: column; align-items: center; text-align: center; }
    .pf-drawer-hero-img { width: 60%; max-width: 200px; }
    .pf-drawer-hero-info { width: 100%; }
    .pf-drawer-position-grid { grid-template-columns: repeat(2, 1fr); }
    .pf-drawer-body { padding: 16px; }
    .pf-drawer-link-btn { flex: 1 1 calc(50% - 4px); }
}
