@import url('https://cdn.jsdelivr.net/gh/orioncactus/pretendard@v1.3.9/dist/web/variable/pretendardvariable-dynamic-subset.min.css');

/* ─── Design Tokens ─── */
:root {
    /* Brand colors */
    --p: #6d5ef5;
    --p2: #a78bfa;
    --p-deep: #4f3fd4;
    --cyan: #06b6d4;
    --green: #10b981;
    --amber: #f59e0b;
    --red: #ef4444;
    --pink: #ec4899;

    /* Backgrounds */
    --bg-body: #fafafd;
    --bg-card: #ffffff;
    --bg-surface: #fafaff;
    --bg-surface-2: #f4f4fb;
    --bg-elevated: #fafaff;
    --bg-nav: rgba(255, 255, 255, 0.78);

    /* Text */
    --text-primary: #0a0a16;
    --text-secondary: #2d2d44;
    --text-tertiary: #555570;
    --text-muted: #8a8aab;

    /* Lines */
    --line: rgba(15, 15, 30, 0.06);
    --line2: rgba(15, 15, 30, 0.1);
    --border: var(--line);
    --border-hover: var(--line2);

    /* Soft color tints */
    --p-soft: rgba(109, 94, 245, 0.08);
    --p-border: rgba(109, 94, 245, 0.15);
    --green-soft: rgba(16, 185, 129, 0.1);
    --green-border: rgba(16, 185, 129, 0.18);
    --green-text: #059669;
    --red-soft: rgba(239, 68, 68, 0.1);
    --red-border: rgba(239, 68, 68, 0.18);
    --red-text: #dc2626;
    --amber-soft: rgba(245, 158, 11, 0.1);
    --amber-border: rgba(245, 158, 11, 0.18);
    --amber-text: #d97706;
    --blue-soft: rgba(6, 182, 212, 0.1);
    --blue-border: rgba(6, 182, 212, 0.18);
    --blue-text: #0891b2;
    --purple-soft: var(--p-soft);
    --purple-border: var(--p-border);

    /* Shadows */
    --shadow-card: 0 4px 20px rgba(15, 15, 30, 0.04), 0 0 0 1px var(--line);
    --shadow-card-hover: 0 12px 32px rgba(109, 94, 245, 0.1), 0 0 0 1px var(--p-border);
    --shadow-elevated: 0 12px 36px rgba(15, 15, 30, 0.08);
    --shadow-glow: 0 8px 28px rgba(109, 94, 245, 0.35);

    /* Compatibility (기존 변수명 매핑) */
    --accent: var(--p);
    --accent-hover: var(--p-deep);
    --accent-soft: var(--p-soft);
    --bg-primary: var(--bg-card);
    --bg-secondary: var(--bg-surface-2);
    --purple: var(--p);
    --blue: var(--cyan);

    /* Radius */
    --radius-xs: 8px;
    --radius-sm: 12px;
    --radius-md: 16px;
    --radius-lg: 20px;
    --radius-xl: 24px;

    --transition: 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

[data-theme="dark"] {
    --bg-body: #07070e;
    --bg-card: #14141e;
    --bg-surface: #1a1a26;
    --bg-surface-2: #232332;
    --bg-elevated: #1a1a26;
    --bg-nav: rgba(7, 7, 14, 0.78);

    --text-primary: #f0f0f8;
    --text-secondary: #c0c0d8;
    --text-tertiary: #8a8aab;
    --text-muted: #5a5a78;

    --line: rgba(255, 255, 255, 0.07);
    --line2: rgba(255, 255, 255, 0.1);

    --p-soft: rgba(139, 122, 245, 0.12);
    --p-border: rgba(139, 122, 245, 0.22);
    --green-soft: rgba(52, 211, 153, 0.12);
    --green-border: rgba(52, 211, 153, 0.22);
    --green-text: #6ee7b7;
    --red-soft: rgba(248, 113, 113, 0.12);
    --red-border: rgba(248, 113, 113, 0.22);
    --red-text: #fca5a5;
    --amber-soft: rgba(251, 191, 36, 0.12);
    --amber-border: rgba(251, 191, 36, 0.22);
    --amber-text: #fcd34d;
    --blue-soft: rgba(34, 211, 238, 0.12);
    --blue-border: rgba(34, 211, 238, 0.22);
    --blue-text: #67e8f9;

    --shadow-card: 0 4px 20px rgba(0, 0, 0, 0.3), 0 0 0 1px var(--line);
    --shadow-card-hover: 0 12px 32px rgba(139, 122, 245, 0.18), 0 0 0 1px rgba(139, 122, 245, 0.3);
    --shadow-elevated: 0 12px 36px rgba(0, 0, 0, 0.5);
    --shadow-glow: 0 8px 28px rgba(139, 122, 245, 0.4);
}

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

body {
    font-family: 'Pretendard Variable', 'Pretendard', -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
    background: var(--bg-body);
    color: var(--text-primary);
    line-height: 1.65;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    letter-spacing: -0.01em;
}

/* ─── Navigation ─── */
.nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    background: var(--bg-nav);
    backdrop-filter: blur(24px) saturate(180%);
    -webkit-backdrop-filter: blur(24px) saturate(180%);
    border-bottom: 1px solid var(--line);
}

.nav-inner {
    max-width: 1600px;
    margin: 0 auto;
    padding: 0 2rem;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.logo {
    font-size: 1.1rem;
    font-weight: 800;
    letter-spacing: -0.03em;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 7px;
    text-decoration: none;
}

.logo-icon {
    font-size: 1.2rem;
    background: linear-gradient(135deg, #6d5ef5 0%, #06b6d4 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.logo span {
    background: linear-gradient(135deg, #6d5ef5 0%, #06b6d4 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.nav-links {
    display: flex;
    align-items: stretch;
    height: 100%;
    gap: 0;
}

.nav-link {
    font-size: 0.85rem;
    color: var(--text-muted);
    text-decoration: none;
    padding: 0 14px;
    display: flex;
    align-items: center;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    transition: color var(--transition), background var(--transition);
    font-weight: 500;
    white-space: nowrap;
}

.nav-link:hover {
    color: var(--text-primary);
    background: var(--bg-surface-2);
    border-radius: var(--radius-xs);
}

.nav-link.active {
    color: var(--text-primary);
    font-weight: 600;
    border-bottom-color: var(--p);
}

.nav-tools {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 0 12px;
    margin-left: 4px;
    border-left: 1px solid var(--line);
}

.nav-login {
    background: linear-gradient(135deg, #6d5ef5, #8b7af5);
    color: #fff;
    padding: 8px 18px;
    border-radius: var(--radius-xs);
    font-weight: 700;
    box-shadow: var(--shadow-glow), inset 0 1px 0 rgba(255, 255, 255, 0.25);
    position: relative;
    overflow: hidden;
    border-bottom: none;
    margin-bottom: 0;
    align-self: center;
    margin-left: 8px;
}

.nav-login::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 60%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.35), transparent);
    animation: shimmer 4s ease-in-out infinite;
}

@keyframes shimmer {
    0% { left: -100%; }
    50%, 100% { left: 160%; }
}

.nav-login:hover {
    color: #fff;
    background: linear-gradient(135deg, #6d5ef5, #8b7af5);
    transform: translateY(-1px);
}

.currency-toggle {
    background: var(--bg-surface-2);
    border: 1px solid var(--line);
    color: var(--text-secondary);
    border-radius: var(--radius-xs);
    height: 30px;
    padding: 0 10px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.03em;
    transition: all var(--transition);
    white-space: nowrap;
}

.currency-toggle:hover {
    color: var(--p);
    border-color: var(--p-border);
    background: var(--p-soft);
}

.currency-toggle.active {
    background: var(--p-soft);
    border-color: var(--p-border);
    color: var(--p);
}

.theme-toggle {
    background: var(--bg-surface-2);
    border: 1px solid var(--line);
    color: var(--text-secondary);
    border-radius: var(--radius-xs);
    width: 30px;
    height: 30px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    transition: all var(--transition);
}

.theme-toggle:hover {
    color: var(--p);
    border-color: var(--p-border);
    background: var(--p-soft);
}

/* ─── Container ─── */
.container {
    max-width: 1600px;
    margin: 0 auto;
    padding: 80px 1.5rem 3rem;
}

/* ─── Hero ─── */
.hero {
    text-align: center;
    padding: 3rem 1rem 2.5rem;
    position: relative;
    overflow: hidden;
}

.hero::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image: radial-gradient(circle, var(--line2) 1px, transparent 1px);
    background-size: 28px 28px;
    pointer-events: none;
    mask-image: radial-gradient(ellipse 75% 70% at 50% 40%, black 0%, transparent 100%);
    -webkit-mask-image: radial-gradient(ellipse 75% 70% at 50% 40%, black 0%, transparent 100%);
    opacity: 0.6;
}

.hero-bg {
    position: absolute;
    inset: 0;
    pointer-events: none;
    overflow: hidden;
    z-index: 0;
}

.hero-blob {
    position: absolute;
    border-radius: 50%;
    filter: blur(70px);
    opacity: 0.55;
}

.hero-blob-1 {
    width: 500px;
    height: 400px;
    top: -150px;
    left: 10%;
    background: radial-gradient(ellipse, rgba(109, 94, 245, 0.25) 0%, transparent 65%);
    animation: hero-bf 14s ease-in-out infinite;
}

.hero-blob-2 {
    width: 400px;
    height: 350px;
    top: -50px;
    right: 5%;
    background: radial-gradient(ellipse, rgba(6, 182, 212, 0.2) 0%, transparent 65%);
    animation: hero-bf 16s ease-in-out infinite reverse;
}

.hero-blob-3 {
    width: 350px;
    height: 280px;
    bottom: -80px;
    left: 35%;
    background: radial-gradient(ellipse, rgba(236, 72, 153, 0.12) 0%, transparent 65%);
    animation: hero-bf 12s ease-in-out infinite;
}

@keyframes hero-bf {
    0%, 100% { transform: translate(0, 0) scale(1); }
    33% { transform: translate(30px, -20px) scale(1.08); }
    66% { transform: translate(-20px, 30px) scale(.95); }
}

[data-theme="dark"] .hero-blob-1 { background: radial-gradient(ellipse, rgba(139, 122, 245, 0.35) 0%, transparent 65%); }
[data-theme="dark"] .hero-blob-2 { background: radial-gradient(ellipse, rgba(34, 211, 238, 0.28) 0%, transparent 65%); }

.hero-glow {
    display: none;
}

.hero-content {
    position: relative;
    z-index: 1;
}

.hero-badge {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    font-size: 0.74rem;
    color: var(--p);
    background: var(--p-soft);
    border: 1px solid var(--p-border);
    padding: 5px 14px 5px 12px;
    border-radius: 100px;
    margin-bottom: 1.25rem;
    font-weight: 600;
    letter-spacing: 0.3px;
}

.hero-badge-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--p);
    box-shadow: 0 0 8px rgba(109, 94, 245, 0.6);
    animation: hero-pulse 2s ease-in-out infinite;
}

@keyframes hero-pulse {
    0%, 100% { opacity: 1; box-shadow: 0 0 8px rgba(109, 94, 245, 0.6); }
    50% { opacity: .6; box-shadow: 0 0 14px rgba(109, 94, 245, 0.3); }
}

.hero-title {
    font-size: 2.8rem;
    font-weight: 900;
    letter-spacing: -0.04em;
    line-height: 1.1;
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.hero-title-hl {
    background: linear-gradient(110deg, #6d5ef5 0%, #a78bfa 35%, #06b6d4 70%, #10b981 100%);
    background-size: 220% 100%;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: gradient-shift 8s ease-in-out infinite;
}

.hero-desc {
    font-size: 0.95rem;
    color: var(--text-tertiary);
    line-height: 1.7;
    margin-bottom: 1.75rem;
}

/* ─── Search ─── */
.search-box {
    display: flex;
    gap: 10px;
    max-width: 540px;
    margin: 0 auto 1.5rem;
}

.search-trigger-text {
    flex: 1;
    padding: 14px 18px 14px 36px;
    background: var(--bg-card);
    border: 1px solid var(--line2);
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 10px;
    box-shadow: var(--shadow-card);
    transition: all var(--transition);
    user-select: none;
}
.search-box:hover .search-trigger-text {
    border-color: var(--p);
}

.search-box button {
    padding: 14px 24px;
    background: linear-gradient(135deg, #6d5ef5, #8b7af5);
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    font-weight: 700;
    font-size: 0.85rem;
    cursor: pointer;
    font-family: inherit;
    transition: transform 0.15s, box-shadow 0.15s;
    display: flex;
    align-items: center;
    gap: 6px;
    box-shadow: var(--shadow-glow), inset 0 1px 0 rgba(255, 255, 255, 0.25);
    position: relative;
    overflow: hidden;
}

.search-box button::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 60%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    animation: shimmer 3s ease-in-out infinite;
}

.search-box button:hover {
    transform: translateY(-2px);
    box-shadow: 0 14px 36px rgba(109, 94, 245, 0.45);
}

.search-box button:active {
    transform: translateY(0);
}

/* ─── Search Trigger ─── */
.search-box {
    cursor: pointer;
}
.search-trigger-text {
    flex: 1;
    color: var(--text-muted);
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 2px 0;
}

/* ─── Search Modal ─── */
.sm-overlay {
    position: fixed;
    inset: 0;
    z-index: 1000;
    background: rgba(0,0,0,0.45);
    display: none;
    justify-content: center;
    align-items: flex-start;
    padding-top: 64px;
}
.sm-overlay.active { display: flex; }

.sm-modal {
    background: var(--bg-card);
    width: 100%;
    max-width: 540px;
    max-height: calc(100vh - 100px);
    border-radius: 20px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 60px rgba(0,0,0,0.25);
    animation: smSlideDown 0.18s ease;
}

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

.sm-header {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 12px 12px 12px 8px;
    border-bottom: 1px solid var(--line);
    flex-shrink: 0;
}

.sm-back {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-primary);
    font-size: 1.15rem;
    flex-shrink: 0;
    transition: background 0.15s;
}
.sm-back:hover { background: var(--bg-surface-2); }

.sm-input {
    flex: 1;
    border: none;
    background: none;
    font-size: 1rem;
    color: var(--text-primary);
    outline: none;
    font-family: inherit;
    padding: 8px 4px;
}
.sm-input::placeholder { color: var(--text-muted); }

.sm-clear {
    width: 28px;
    height: 28px;
    display: none;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: var(--bg-surface-2);
    border: none;
    cursor: pointer;
    color: var(--text-muted);
    font-size: 0.8rem;
    flex-shrink: 0;
}
.sm-clear.visible { display: flex; }

.sm-results {
    overflow-y: auto;
    flex: 1;
    -webkit-overflow-scrolling: touch;
}

.sm-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    cursor: pointer;
    transition: background 0.1s;
}
.sm-item:hover,
.sm-item:active { background: var(--bg-surface-2); }
.sm-item + .sm-item { border-top: 1px solid var(--line); }

.sm-empty {
    padding: 40px 16px;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.sm-section-label {
    padding: 14px 16px 6px;
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.sm-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 4px 16px 12px;
}

.sm-chip {
    padding: 6px 14px;
    border-radius: 20px;
    border: 1px solid var(--line2);
    background: var(--bg-surface-2);
    color: var(--text-primary);
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    transition: background 0.15s;
}
.sm-chip:hover { background: var(--bg-surface); }

.sm-chip-del {
    display: inline-flex;
    align-items: center;
    margin-left: 4px;
    opacity: 0.5;
    font-size: 0.8rem;
    vertical-align: middle;
}
.sm-chip-del:hover { opacity: 1; }

.sd-logo-wrap {
    width: 36px;
    height: 36px;
    flex-shrink: 0;
}
.sd-logo {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    object-fit: cover;
}
.sd-logo-fallback {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    background: linear-gradient(135deg, #6d5ef5, #a78bfa);
    color: #fff;
    font-size: 0.85rem;
    font-weight: 800;
    align-items: center;
    justify-content: center;
}
.sd-name {
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.sd-symbol {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 2px;
}
.sd-exchange {
    font-size: 0.72rem;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: 5px;
    background: var(--bg-surface-2);
    color: var(--text-muted);
    flex-shrink: 0;
}

@media (max-width: 600px) {
    .sm-overlay {
        padding: 0;
        background: transparent;
    }
    .sm-modal {
        max-width: 100%;
        max-height: 100%;
        height: 100%;
        border-radius: 0;
        box-shadow: none;
        animation: none;
    }
}

/* ─── Quick Stock Chips ─── */
.quick-stocks {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: center;
}

.chip {
    background: var(--bg-card);
    border: 1px solid var(--line);
    color: var(--text-secondary);
    padding: 7px 14px 7px 7px;
    border-radius: 100px;
    cursor: pointer;
    font-family: inherit;
    font-size: 0.78rem;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: all var(--transition);
    box-shadow: var(--shadow-card);
}

.chip:hover {
    border-color: var(--p-border);
    color: var(--p);
    transform: translateY(-1px);
}

.chip-ticker {
    font-size: 0.7rem;
    font-weight: 800;
    padding: 3px 7px;
    border-radius: 100px;
    color: #fff;
    letter-spacing: 0.3px;
}

.chip-ticker.green { background: linear-gradient(135deg, #10b981, #34d399); }
.chip-ticker.blue { background: linear-gradient(135deg, #06b6d4, #38bdf8); }
.chip-ticker.purple { background: linear-gradient(135deg, #6d5ef5, #a78bfa); }
.chip-ticker.amber { background: linear-gradient(135deg, #f59e0b, #fbbf24); }
.chip-ticker.red { background: linear-gradient(135deg, #ef4444, #f87171); }

/* ─── Feature Cards ─── */
.features {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 14px;
    margin-bottom: 2rem;
    margin-top: 1.5rem;
}

.feature-card {
    background: var(--bg-card);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition);
    position: relative;
    overflow: hidden;
}

.feature-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--p-border), transparent);
    opacity: 0;
    transition: opacity var(--transition);
}

.feature-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-card-hover);
}

.feature-card:hover::before {
    opacity: 1;
}

.feature-icon {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.15rem;
    margin-bottom: 14px;
    border: 1px solid;
}

.feature-icon.green {
    background: linear-gradient(135deg, var(--green-soft), rgba(16, 185, 129, 0.04));
    color: var(--green);
    border-color: var(--green-border);
}

.feature-icon.purple {
    background: linear-gradient(135deg, var(--p-soft), rgba(109, 94, 245, 0.04));
    color: var(--p);
    border-color: var(--p-border);
}

.feature-icon.blue {
    background: linear-gradient(135deg, var(--blue-soft), rgba(6, 182, 212, 0.04));
    color: var(--cyan);
    border-color: var(--blue-border);
}

.feature-title {
    font-size: 1rem;
    font-weight: 800;
    margin-bottom: 6px;
    color: var(--text-primary);
    letter-spacing: -0.02em;
}

.feature-desc {
    font-size: 0.82rem;
    color: var(--text-tertiary);
    line-height: 1.65;
}

/* ─── Plan Section ─── */
.plan-section {
    margin-top: 2rem;
}

.plan-section-title {
    font-size: 1.3rem;
    font-weight: 800;
    text-align: center;
    margin-bottom: 1.25rem;
    color: var(--text-primary);
    letter-spacing: -0.02em;
}

.plan-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}

.plan-card {
    background: var(--bg-card);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
}

.plan-card--premium {
    background: linear-gradient(160deg, var(--bg-card) 0%, var(--p-soft) 100%);
    border-color: var(--p-border);
    position: relative;
    overflow: hidden;
}

.plan-card--premium::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, #6d5ef5, #a78bfa, #06b6d4);
}

.plan-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 0.72rem;
    font-weight: 800;
    padding: 5px 12px;
    border-radius: 100px;
    margin-bottom: 16px;
    letter-spacing: 0.5px;
}

.plan-badge--free {
    background: var(--bg-surface-2);
    color: var(--text-tertiary);
}

.plan-badge--premium {
    background: var(--p-soft);
    color: var(--p);
    border: 1px solid var(--p-border);
}

.plan-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.plan-list li {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.55;
}

.plan-list li i {
    color: var(--green);
    font-size: 1rem;
    flex-shrink: 0;
    margin-top: 1px;
}

.plan-list li.plan-limit {
    color: var(--text-muted);
}

.plan-list li.plan-limit i {
    color: var(--text-muted);
}

/* ─── Back Button ─── */
.back-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    background: var(--bg-card);
    border: 1px solid var(--line);
    border-radius: var(--radius-xs);
    color: var(--text-secondary);
    cursor: pointer;
    font-family: inherit;
    font-size: 0.8rem;
    font-weight: 600;
    margin-bottom: 1.25rem;
    transition: all var(--transition);
    text-decoration: none;
}

.back-btn:hover {
    color: var(--p);
    border-color: var(--p-border);
    background: var(--p-soft);
}

/* ─── Loading ─── */
.loading {
    display: none;
    text-align: center;
    padding: 3rem 1rem;
}

.loading.active {
    display: block;
}

.loading p {
    color: var(--text-muted);
    font-size: 0.85rem;
    margin-top: 1rem;
}

.spinner {
    width: 36px;
    height: 36px;
    border: 3px solid var(--line2);
    border-top-color: var(--p);
    border-radius: 50%;
    margin: 0 auto;
    animation: spin 0.8s linear infinite;
}

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

/* ─── Error ─── */
.error-msg {
    display: none;
    padding: 1rem 1.25rem;
    background: var(--red-soft);
    border: 1px solid var(--red-border);
    border-radius: var(--radius-sm);
    color: var(--red-text);
    font-size: 0.85rem;
    margin-bottom: 1.5rem;
}

.error-msg.active {
    display: block;
}

/* ─── Main Page (Home) ─── */
#mainPage {
    display: block;
}

/* ─── Result Area ─── */
#result {
    display: none;
}

#result.active {
    display: block;
}

/* ─── Stock Header ─── */
.stock-header {
    margin-bottom: 1.5rem;
    padding: 1.25rem 1.5rem;
    background: var(--bg-card);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    position: relative;
    overflow: hidden;
}

.stock-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, #6d5ef5, #a78bfa, #06b6d4, #10b981);
    background-size: 200% 100%;
    animation: gradient-shift 6s ease-in-out infinite;
}

@keyframes gradient-shift {
    0%, 100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
}

.stock-name-row {
    display: flex;
    align-items: baseline;
    gap: 10px;
    margin-bottom: 8px;
    flex-wrap: wrap;
}

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

.stock-symbol {
    font-size: 0.78rem;
    color: var(--text-muted);
    font-weight: 600;
    padding: 3px 9px;
    background: var(--bg-surface-2);
    border-radius: 100px;
    letter-spacing: 0.3px;
}

.stock-price-row {
    display: flex;
    align-items: baseline;
    gap: 12px;
    flex-wrap: wrap;
}

.stock-price {
    font-size: 2rem;
    font-weight: 900;
    letter-spacing: -0.04em;
    font-feature-settings: 'tnum';
    color: var(--text-primary);
}

.stock-change {
    font-size: 0.8rem;
    padding: 4px 11px;
    border-radius: 100px;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    gap: 3px;
}

.stock-change.up {
    background: var(--green-soft);
    color: var(--green-text);
    border: 1px solid var(--green-border);
}

.stock-change.down {
    background: var(--red-soft);
    color: var(--red-text);
    border: 1px solid var(--red-border);
}

.stock-time {
    font-size: 0.72rem;
    color: var(--text-muted);
    margin-top: 5px;
}

/* ─── Tabs ─── */
.tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 1.25rem;
    background: var(--bg-surface-2);
    border-radius: var(--radius-sm);
    padding: 4px;
    overflow-x: auto;
    border: 1px solid var(--line);
}

.tab {
    flex: 1;
    padding: 9px 14px;
    font-size: 0.8rem;
    color: var(--text-muted);
    background: none;
    border: none;
    border-radius: var(--radius-xs);
    cursor: pointer;
    font-family: inherit;
    font-weight: 600;
    white-space: nowrap;
    transition: all var(--transition);
    letter-spacing: -0.01em;
}

.tab:hover {
    color: var(--text-secondary);
}

.tab.active {
    color: #fff;
    background: linear-gradient(135deg, #6d5ef5, #8b7af5);
    box-shadow: 0 4px 14px rgba(109, 94, 245, 0.3);
}

/* ─── Tab Content ─── */
.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
    animation: fadein-tab 0.35s ease;
}

@keyframes fadein-tab {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ─── Card ─── */
.card {
    background: var(--bg-card);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    margin-bottom: 12px;
    transition: border-color var(--transition);
    position: relative;
    overflow: hidden;
}

.card-title {
    font-size: 1.02rem;
    font-weight: 800;
    margin-bottom: 4px;
    letter-spacing: -0.02em;
    color: var(--text-primary);
}

.card-subtitle {
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-bottom: 1.25rem;
}

/* ─── Signal Items ─── */
.signal-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.signal-item {
    display: flex;
    gap: 12px;
    align-items: center;
    padding: 12px 14px;
    background: var(--bg-surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    transition: border-color var(--transition), transform var(--transition);
}

.signal-item:hover {
    border-color: var(--p-border);
    transform: translateX(4px);
}

.signal-icon {
    width: 38px;
    height: 38px;
    border-radius: 11px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.05rem;
    flex-shrink: 0;
    border: 1px solid;
}

.signal-icon.green {
    background: linear-gradient(135deg, var(--green-soft), rgba(16, 185, 129, 0.04));
    color: var(--green);
    border-color: var(--green-border);
}

.signal-icon.red {
    background: linear-gradient(135deg, var(--red-soft), rgba(239, 68, 68, 0.04));
    color: var(--red);
    border-color: var(--red-border);
}

.signal-icon.amber {
    background: linear-gradient(135deg, var(--amber-soft), rgba(245, 158, 11, 0.04));
    color: var(--amber);
    border-color: var(--amber-border);
}

.signal-icon.blue {
    background: linear-gradient(135deg, var(--blue-soft), rgba(6, 182, 212, 0.04));
    color: var(--cyan);
    border-color: var(--blue-border);
}

.signal-title {
    font-size: 0.88rem;
    font-weight: 700;
    margin-bottom: 3px;
    color: var(--text-primary);
}

.signal-desc {
    font-size: 0.78rem;
    color: var(--text-tertiary);
    line-height: 1.55;
}

/* ─── Metric Grid ─── */
.metric-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
}

.metric-card {
    background: var(--bg-surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    padding: 14px;
    transition: border-color var(--transition);
}

.metric-card:hover {
    border-color: var(--p-border);
}

.metric-card--wide {
    grid-column: 1 / -1;
}

.metric-card-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
}

.metric-icon {
    width: 30px;
    height: 30px;
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.95rem;
    flex-shrink: 0;
}

.metric-label {
    font-size: 0.72rem;
    color: var(--text-muted);
    font-weight: 600;
    letter-spacing: -0.01em;
}

.metric-value {
    font-size: 1.1rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    font-feature-settings: 'tnum';
    color: var(--text-primary);
}

.metric-sub {
    font-size: 0.7rem;
    color: var(--text-muted);
    margin-top: 4px;
    font-weight: 500;
}

/* 가격 범위 바 */
.range-bar-wrap {
    margin-top: 4px;
}

.range-bar {
    height: 6px;
    background: var(--bg-surface-2);
    border-radius: 100px;
    overflow: hidden;
    margin-bottom: 8px;
    border: 1px solid var(--line);
}

.range-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #6d5ef5, #06b6d4);
    border-radius: 100px;
    transition: width 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

.range-labels {
    display: flex;
    justify-content: space-between;
    font-size: 0.74rem;
    font-feature-settings: 'tnum';
    font-weight: 700;
    color: var(--text-primary);
}

.range-pct {
    font-size: 0.7rem;
    color: var(--text-muted);
    font-weight: 500;
}

/* ─── Indicator Grid ─── */
.indicator-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.indicator-card {
    background: var(--bg-surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    padding: 16px;
    transition: border-color var(--transition);
}

.indicator-card:hover {
    border-color: var(--p-border);
}

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

.indicator-name {
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--text-secondary);
}

.indicator-value {
    font-size: 1.1rem;
    font-weight: 800;
    font-feature-settings: 'tnum';
}

.indicator-bar {
    height: 5px;
    background: var(--bg-surface-2);
    border-radius: 100px;
    margin-bottom: 10px;
    overflow: hidden;
    border: 1px solid var(--line);
}

.indicator-bar-fill {
    height: 100%;
    border-radius: 100px;
    transition: width 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

.indicator-note {
    font-size: 0.78rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 5px;
}

/* ─── SMA Rows ─── */
.sma-row {
    display: flex;
    justify-content: space-between;
    font-size: 0.85rem;
    padding: 6px 0;
    font-feature-settings: 'tnum';
    border-bottom: 1px solid var(--line);
}

.sma-row:last-of-type {
    border-bottom: none;
}

.sma-label {
    color: var(--text-muted);
    font-weight: 500;
}

.sma-row span:last-child {
    font-weight: 700;
}

/* ─── Financial Table ─── */
.fin-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
    font-feature-settings: 'tnum';
}

.fin-table th {
    text-align: left;
    font-weight: 700;
    color: var(--text-muted);
    padding: 10px 12px;
    font-size: 0.74rem;
    letter-spacing: 0.3px;
    text-transform: uppercase;
    border-bottom: 1px solid var(--line);
}

.fin-table th:not(:first-child) {
    text-align: right;
}

.fin-table td {
    padding: 11px 12px;
    border-bottom: 1px solid var(--line);
    color: var(--text-secondary);
}

.fin-table td:first-child {
    font-weight: 600;
    color: var(--text-primary);
}

.fin-table td:not(:first-child) {
    text-align: right;
    font-weight: 600;
}

.fin-table tr:last-child td {
    border-bottom: none;
}

.fin-table tr.fin-row-highlight {
    background: var(--bg-surface);
}

.fin-table tr.fin-row-highlight td:first-child {
    font-weight: 800;
}

.fin-growth {
    display: inline-flex;
    align-items: center;
    gap: 1px;
    font-size: 0.72rem;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 5px;
    margin-left: 6px;
    background: var(--green-soft);
}

.fin-latest-badge {
    background: linear-gradient(135deg, #6d5ef5, #8b7af5);
    color: #fff;
    font-size: 0.62rem;
    font-weight: 800;
    padding: 2px 7px;
    border-radius: 100px;
    margin-left: 6px;
    letter-spacing: 0.5px;
    vertical-align: 2px;
}

/* ─── Events ─── */
.event-item {
    display: flex;
    gap: 14px;
    padding: 14px;
    background: var(--bg-surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    margin-bottom: 10px;
    transition: border-color var(--transition);
}

.event-item:hover {
    border-color: var(--p-border);
}

.event-item:last-child {
    margin-bottom: 0;
}

.event-icon {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    flex-shrink: 0;
    border: 1px solid var(--line);
}

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

.event-name {
    font-size: 0.92rem;
    font-weight: 700;
    margin-bottom: 4px;
    color: var(--text-primary);
}

.event-date {
    font-size: 0.78rem;
    color: var(--text-tertiary);
    line-height: 1.5;
}

/* ─── News ─── */
.news-item {
    padding: 14px;
    background: var(--bg-surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    margin-bottom: 10px;
    transition: border-color var(--transition);
}

.news-item:hover {
    border-color: var(--p-border);
}

.news-item:last-child {
    margin-bottom: 0;
}

.news-title {
    font-size: 0.9rem;
    font-weight: 700;
    line-height: 1.5;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.news-meta {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    font-size: 0.74rem;
    color: var(--text-muted);
}

.sentiment-badge {
    display: inline-flex;
    align-items: center;
    font-size: 0.7rem;
    font-weight: 800;
    padding: 3px 9px;
    border-radius: 5px;
    letter-spacing: 0.3px;
}

.sentiment-badge.positive,
.sentiment-badge.green {
    background: var(--green-soft);
    color: var(--green-text);
    border: 1px solid var(--green-border);
}

.sentiment-badge.negative,
.sentiment-badge.red {
    background: var(--red-soft);
    color: var(--red-text);
    border: 1px solid var(--red-border);
}

.sentiment-badge.neutral,
.sentiment-badge.amber {
    background: var(--bg-surface-2);
    color: var(--text-tertiary);
    border: 1px solid var(--line2);
}

/* ─── Chart period buttons ─── */
.chart-type-btns,
.chart-period-btns {
    display: inline-flex;
    background: var(--bg-surface-2);
    border-radius: var(--radius-xs);
    padding: 3px;
    gap: 2px;
    border: 1px solid var(--line);
}

.type-btn,
.period-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    padding: 6px 11px;
    border-radius: 6px;
    cursor: pointer;
    font-family: inherit;
    font-size: 0.74rem;
    font-weight: 600;
    transition: all var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 4px;
    white-space: nowrap;
}

.type-btn:hover,
.period-btn:hover {
    color: var(--text-secondary);
}

.type-btn.active,
.period-btn.active {
    background: var(--bg-card);
    color: var(--text-primary);
    box-shadow: 0 2px 6px rgba(15, 15, 30, 0.06);
}

[data-theme="dark"] .type-btn.active,
[data-theme="dark"] .period-btn.active {
    background: var(--bg-elevated);
}

/* ─── MA Toggle Chips ─── */
.chart-ma-btns {
    display: flex;
    align-items: center;
    gap: 6px;
    margin: 12px 0 8px;
    flex-wrap: wrap;
}

.chart-ma-label {
    font-size: 0.72rem;
    color: var(--text-muted);
    font-weight: 600;
    margin-right: 4px;
}

.ma-btn {
    background: var(--bg-surface);
    border: 1px solid var(--line);
    color: var(--text-muted);
    padding: 5px 10px;
    border-radius: 100px;
    cursor: pointer;
    font-family: inherit;
    font-size: 0.72rem;
    font-weight: 600;
    transition: all var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.ma-btn:hover {
    color: var(--text-secondary);
}

.ma-btn.active {
    background: var(--bg-card);
    color: var(--text-primary);
    border-color: var(--line2);
}

.ma-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
}

/* ─── Chart Extras ─── */
.chart-stats {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
    padding: 10px 12px;
    background: var(--bg-surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-xs);
    margin-bottom: 12px;
    font-size: 0.78rem;
}

.chart-stats span {
    color: var(--text-muted);
}

.chart-stats b {
    color: var(--text-primary);
    font-weight: 700;
    margin-left: 4px;
    font-feature-settings: 'tnum';
}

.chart-vol-header {
    font-size: 0.72rem;
    color: var(--text-muted);
    font-weight: 600;
    margin: 14px 0 6px;
    letter-spacing: 0.3px;
}

/* ─── Sector Section ─── */
.sector-section {
    margin-bottom: 1.5rem;
}

.sector-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 8px;
}

.sector-card {
    background: var(--bg-surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    padding: 12px;
    transition: border-color var(--transition);
}

.sector-card:hover {
    border-color: var(--p-border);
}

.sector-name {
    font-size: 0.78rem;
    color: var(--text-secondary);
    font-weight: 600;
    margin-bottom: 4px;
}

.sector-change {
    font-size: 0.95rem;
    font-weight: 800;
    font-feature-settings: 'tnum';
}

.sector-change.up { color: var(--green); }
.sector-change.down { color: var(--red); }

/* ─── Watchlist Modal ─── */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(7, 7, 14, 0.5);
    backdrop-filter: blur(8px);
    z-index: 200;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.modal-overlay.active {
    display: flex;
}

.modal {
    background: var(--bg-card);
    border: 1px solid var(--line);
    border-radius: var(--radius-xl);
    padding: 1.5rem;
    max-width: 480px;
    width: 100%;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: var(--shadow-elevated);
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.25rem;
}

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

.modal-close {
    background: var(--bg-surface-2);
    border: 1px solid var(--line);
    color: var(--text-secondary);
    border-radius: var(--radius-xs);
    width: 32px;
    height: 32px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    transition: all var(--transition);
}

.modal-close:hover {
    color: var(--red);
    border-color: var(--red-border);
    background: var(--red-soft);
}

.watchlist-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    background: var(--bg-surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    margin-bottom: 6px;
    cursor: pointer;
    transition: all var(--transition);
}

.watchlist-item:hover {
    border-color: var(--p-border);
    background: var(--p-soft);
}

.watchlist-symbol {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text-primary);
}

.watchlist-right {
    display: flex;
    align-items: center;
    gap: 10px;
}

.watchlist-price {
    font-size: 0.82rem;
    color: var(--text-secondary);
    font-weight: 600;
    font-feature-settings: 'tnum';
}

/* ─── Watchlist Heart Button ─── */
.watchlist-btn {
    background: var(--bg-surface-2);
    border: 1px solid var(--line);
    color: var(--text-muted);
    border-radius: var(--radius-xs);
    width: 32px;
    height: 32px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    transition: all var(--transition);
    margin-left: 4px;
}

.watchlist-btn:hover {
    color: var(--red);
    border-color: var(--red-border);
    background: var(--red-soft);
}

.watchlist-btn.active {
    color: var(--red);
    background: var(--red-soft);
    border-color: var(--red-border);
}

.watchlist-btn.active i::before {
    content: "\f0c0";
}

/* ─── App Layout (Main + Sidebar) ─── */
.app-layout {
    display: grid;
    grid-template-columns: 240px 1fr 240px;
    gap: 1.25rem;
    align-items: start;
}

.main-content {
    min-width: 0;
}

.popular-sidebar,
.market-sidebar {
    position: sticky;
    top: 80px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.sidebar-tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 10px;
}

.sidebar-tab-btn {
    flex: 1;
    padding: 4px 0;
    font-size: 0.72rem;
    font-weight: 600;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.15s;
}

.sidebar-tab-btn.active {
    background: var(--p);
    color: #fff;
    border-color: var(--p);
}

.sidebar-block {
    background: var(--bg-card);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    padding: 1rem;
}

.sidebar-label {
    font-size: 0.74rem;
    font-weight: 700;
    color: var(--text-muted);
    margin-bottom: 10px;
    letter-spacing: 0.3px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    text-transform: uppercase;
}

.sidebar-label-sub {
    font-size: 0.65rem;
    color: var(--text-muted);
    font-weight: 500;
    text-transform: none;
    letter-spacing: 0;
}

.sidebar-loading {
    font-size: 0.78rem;
    color: var(--text-muted);
    padding: 8px 0;
    text-align: center;
}

.popular-item {
    display: grid;
    grid-template-columns: 28px 1fr auto;
    align-items: center;
    gap: 8px;
    padding: 10px 4px;
    border-bottom: 1px solid var(--line);
    cursor: pointer;
    transition: background var(--transition);
}

.popular-logo-wrap {
    width: 28px;
    height: 28px;
    flex-shrink: 0;
}
.popular-logo {
    width: 28px;
    height: 28px;
    border-radius: 6px;
    object-fit: contain;
    background: var(--bg-surface-2);
}
.popular-logo-fallback {
    width: 28px;
    height: 28px;
    border-radius: 6px;
    background: linear-gradient(135deg, #6d5ef5, #a78bfa);
    color: #fff;
    font-size: 0.72rem;
    font-weight: 800;
    display: flex;
    align-items: center;
    justify-content: center;
}

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

.popular-item:hover {
    background: var(--bg-surface);
    border-radius: var(--radius-xs);
}

.popular-left {
    display: flex;
    flex-direction: column;
    gap: 3px;
    min-width: 0;
}

.popular-right {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 3px;
}

.popular-symbol {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.01em;
}

.popular-sub {
    font-size: 0.72rem;
    color: var(--text-muted);
    font-weight: 500;
    font-feature-settings: 'tnum';
}

.popular-price {
    font-size: 0.82rem;
    color: var(--text-secondary);
    font-weight: 600;
    font-feature-settings: 'tnum';
}

.popular-change {
    font-size: 0.72rem;
    font-weight: 700;
    font-feature-settings: 'tnum';
    padding: 2px 6px;
    border-radius: 5px;
}

.popular-change.up { color: var(--green); background: var(--green-soft); }
.popular-change.down { color: var(--red); background: var(--red-soft); }

/* ─── Macro Indicators ─── */
.macro-item {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto;
    align-items: center;
    gap: 6px;
    padding: 8px 0;
    border-bottom: 1px solid var(--line);
}

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

.macro-left {
    display: flex;
    flex-direction: column;
    gap: 1px;
    min-width: 0;
}

.macro-right {
    display: flex;
    align-items: center;
    justify-content: flex-end;
}

.macro-name {
    font-size: 0.74rem;
    color: var(--text-secondary);
    font-weight: 700;
    letter-spacing: -0.01em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.macro-price {
    font-size: 0.72rem;
    color: var(--text-primary);
    font-weight: 600;
    font-feature-settings: 'tnum';
}

.macro-value {
    font-size: 0.82rem;
    font-weight: 700;
    font-feature-settings: 'tnum';
    color: var(--text-primary);
}

.macro-change {
    font-size: 0.7rem;
    font-weight: 700;
    font-feature-settings: 'tnum';
    padding: 1px 6px;
    border-radius: 5px;
    white-space: nowrap;
}

.macro-change.up { color: var(--green); background: var(--green-soft); }
.macro-change.down { color: var(--red); background: var(--red-soft); }

/* ─── Sector List in Sidebar ─── */
#sectorGrid {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.sector-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 7px 10px;
    border-radius: var(--radius-xs);
    transition: background var(--transition);
}

.sector-item:hover {
    background: var(--bg-surface);
}

.sector-item-name {
    font-size: 0.78rem;
    color: var(--text-secondary);
    font-weight: 600;
}

.sector-item-change {
    font-size: 0.72rem;
    font-weight: 700;
    font-feature-settings: 'tnum';
    padding: 2px 7px;
    border-radius: 5px;
}

.sector-item-change.up { color: var(--green); background: var(--green-soft); }
.sector-item-change.down { color: var(--red); background: var(--red-soft); }

/* ─── Gate Screens (auth / premium) ─── */
.gate-card,
.gate-screen {
    background: var(--bg-card);
    border: 1px solid var(--line);
    border-radius: var(--radius-xl);
    padding: 3rem 2rem 2.5rem;
    text-align: center;
    max-width: 520px;
    margin: 3rem auto;
    position: relative;
    overflow: hidden;
    box-shadow: var(--shadow-card);
}

.gate-card::before,
.gate-screen::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, #6d5ef5, #a78bfa, #06b6d4);
}

.gate-icon {
    width: 72px;
    height: 72px;
    border-radius: 20px;
    background: linear-gradient(135deg, var(--p-soft), rgba(109, 94, 245, 0.04));
    border: 1px solid var(--p-border);
    color: var(--p);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    margin: 0 auto 1.25rem;
    box-shadow: 0 8px 24px rgba(109, 94, 245, 0.12);
}

.gate-icon--lock {
    width: 72px;
    height: 72px;
    border-radius: 20px;
    background: linear-gradient(135deg, var(--p-soft), rgba(109, 94, 245, 0.04));
    border: 1px solid var(--p-border);
    color: var(--p);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
}

.gate-icon--crown {
    background: linear-gradient(135deg, var(--amber-soft), rgba(245, 158, 11, 0.04));
    border-color: var(--amber-border);
    color: var(--amber);
    box-shadow: 0 8px 24px rgba(245, 158, 11, 0.15);
}

.gate-title {
    font-size: 1.35rem;
    font-weight: 900;
    margin-bottom: 0.6rem;
    color: var(--text-primary);
    letter-spacing: -0.03em;
}

.gate-desc {
    font-size: 0.92rem;
    color: var(--text-tertiary);
    line-height: 1.7;
    margin-bottom: 1.75rem;
}

.gate-cta,
.gate-btn,
.gate-btn--primary {
    background: linear-gradient(135deg, #6d5ef5, #8b7af5);
    color: #fff;
    border: none;
    border-radius: var(--radius-sm);
    padding: 12px 24px;
    font-size: 0.88rem;
    font-weight: 700;
    cursor: pointer;
    font-family: inherit;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    box-shadow: var(--shadow-glow), inset 0 1px 0 rgba(255, 255, 255, 0.25);
    text-decoration: none;
    transition: transform 0.15s, box-shadow 0.15s;
    position: relative;
    overflow: hidden;
}

.gate-cta::after,
.gate-btn::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 60%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    animation: shimmer 3s ease-in-out infinite;
    pointer-events: none;
}

.gate-cta:hover,
.gate-btn:hover,
.gate-btn--primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 32px rgba(109, 94, 245, 0.45);
    color: #fff;
}

.gate-icon--lock {
    width: 56px;
    height: 56px;
    border-radius: 16px;
    background: linear-gradient(135deg, var(--p-soft), rgba(109, 94, 245, 0.04));
    border: 1px solid var(--p-border);
    color: var(--p);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.6rem;
}

/* ─── Portfolio Page ─── */
.pf-page {
    max-width: 1100px;
    margin: 0 auto;
}

.pf-header {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 1.25rem;
    flex-wrap: wrap;
}

.pf-title {
    font-size: 1.5rem;
    font-weight: 900;
    letter-spacing: -0.03em;
    color: var(--text-primary);
}

.pf-refresh-btn {
    background: var(--bg-card);
    border: 1px solid var(--line);
    color: var(--text-secondary);
    border-radius: var(--radius-xs);
    padding: 8px 14px;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: all var(--transition);
}

.pf-refresh-btn:hover {
    color: var(--p);
    border-color: var(--p-border);
    background: var(--p-soft);
}

/* Summary cards */
.pf-summary-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    margin-bottom: 1.25rem;
}

.pf-summary-card {
    background: var(--bg-card);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    padding: 1.25rem;
    position: relative;
    overflow: hidden;
    transition: border-color var(--transition), transform var(--transition);
}

.pf-summary-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--p-border), transparent);
    opacity: 0;
    transition: opacity var(--transition);
}

.pf-summary-card:hover {
    border-color: var(--p-border);
    transform: translateY(-2px);
}

.pf-summary-card:hover::before {
    opacity: 1;
}

.pf-summary-label {
    font-size: 0.72rem;
    color: var(--text-muted);
    font-weight: 700;
    margin-bottom: 6px;
    letter-spacing: 0.4px;
    text-transform: uppercase;
}

.pf-summary-value {
    font-size: 1.4rem;
    font-weight: 900;
    font-feature-settings: 'tnum';
    color: var(--text-primary);
    letter-spacing: -0.03em;
}

/* Add form */
.pf-add-form {
    display: grid;
    grid-template-columns: 1.4fr 1fr 1fr auto;
    gap: 8px;
}

.pf-add-form input {
    padding: 11px 14px;
    background: var(--bg-surface);
    border: 1px solid var(--line2);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 0.85rem;
    font-family: inherit;
    transition: all var(--transition);
}

.pf-add-form input:focus {
    outline: none;
    border-color: var(--p);
    background: var(--bg-card);
    box-shadow: 0 0 0 4px var(--p-soft);
}

.pf-add-form input::placeholder {
    color: var(--text-muted);
}

.pf-add-form button {
    padding: 11px 20px;
    background: linear-gradient(135deg, #6d5ef5, #8b7af5);
    color: #fff;
    border: none;
    border-radius: var(--radius-sm);
    font-weight: 700;
    font-size: 0.85rem;
    cursor: pointer;
    font-family: inherit;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    box-shadow: var(--shadow-glow), inset 0 1px 0 rgba(255, 255, 255, 0.25);
    transition: transform 0.15s, box-shadow 0.15s;
    white-space: nowrap;
}

.pf-add-form button:hover {
    transform: translateY(-1px);
    box-shadow: 0 12px 32px rgba(109, 94, 245, 0.4);
}

/* Two-column layout */
.pf-main-grid {
    display: grid;
    grid-template-columns: 1.3fr 1fr;
    gap: 12px;
}

/* Position list */
.pf-position {
    display: grid;
    grid-template-columns: 1fr auto auto;
    gap: 14px;
    padding: 14px;
    background: var(--bg-surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    margin-bottom: 8px;
    align-items: center;
    transition: border-color var(--transition);
}

.pf-position:hover {
    border-color: var(--p-border);
}

.pf-position:last-child {
    margin-bottom: 0;
}

.pf-pos-left {
    display: flex;
    flex-direction: column;
    gap: 3px;
    min-width: 0;
}

.pf-pos-right {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 3px;
}

.pf-pos-symbol {
    font-size: 0.95rem;
    font-weight: 800;
    color: var(--text-primary);
    letter-spacing: -0.01em;
}

.pf-pos-detail {
    font-size: 0.74rem;
    color: var(--text-muted);
    font-feature-settings: 'tnum';
}

.pf-pos-price {
    font-size: 0.92rem;
    font-weight: 800;
    color: var(--text-primary);
    font-feature-settings: 'tnum';
    letter-spacing: -0.01em;
}

.pf-pos-pnl {
    font-size: 0.76rem;
    font-weight: 700;
    font-feature-settings: 'tnum';
}

.pf-pos-del {
    background: var(--bg-surface-2);
    border: 1px solid var(--line);
    color: var(--text-muted);
    border-radius: var(--radius-xs);
    width: 32px;
    height: 32px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    transition: all var(--transition);
}

.pf-pos-del:hover {
    color: var(--red);
    border-color: var(--red-border);
    background: var(--red-soft);
}

/* Empty state */
.pf-empty {
    text-align: center;
    padding: 2.5rem 1rem;
    color: var(--text-muted);
}

.pf-empty i {
    font-size: 2.5rem;
    color: var(--text-muted);
    display: block;
    margin-bottom: 12px;
    opacity: 0.6;
}

.pf-empty p {
    font-size: 0.92rem;
    color: var(--text-secondary);
    font-weight: 700;
    margin-bottom: 4px;
}

.pf-empty span {
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* AI Analysis button */
.pf-analysis-btn {
    background: linear-gradient(135deg, #6d5ef5, #8b7af5);
    color: #fff;
    border: none;
    border-radius: var(--radius-xs);
    padding: 8px 16px;
    font-size: 0.78rem;
    font-weight: 700;
    cursor: pointer;
    font-family: inherit;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    box-shadow: var(--shadow-glow), inset 0 1px 0 rgba(255, 255, 255, 0.25);
    transition: transform 0.15s, box-shadow 0.15s;
}

.pf-analysis-btn:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 10px 28px rgba(109, 94, 245, 0.4);
}

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

/* ─── Responsive ─── */
@media (max-width: 1280px) {
    .app-layout {
        grid-template-columns: 220px 1fr 220px;
        gap: 1rem;
    }
}

@media (max-width: 1024px) {
    .app-layout {
        grid-template-columns: 1fr;
    }

    .popular-sidebar,
    .market-sidebar {
        position: static;
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 12px;
    }
}

@media (max-width: 1024px) {
    .pf-main-grid {
        grid-template-columns: 1fr;
    }

    .pf-summary-grid {
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 768px) {
    .container {
        padding: 80px 1rem 2rem;
    }

    .hero-title {
        font-size: 2rem;
    }

    .features {
        grid-template-columns: 1fr;
    }

    .metric-grid {
        grid-template-columns: 1fr 1fr;
    }

    .indicator-grid {
        grid-template-columns: 1fr;
    }

    .plan-grid {
        grid-template-columns: 1fr;
    }

    .search-box {
        flex-direction: row;
    }

    .search-box button .btn-text {
        display: none;
    }

    .search-box button {
        padding: 14px 18px;
        flex-shrink: 0;
    }

    .stock-price {
        font-size: 1.6rem;
    }

    .stock-name {
        font-size: 1.1rem;
    }

    .nav-inner {
        padding: 0 1rem;
        height: 56px;
    }

    .nav-links {
        gap: 2px;
    }

    .nav-link {
        font-size: 0.75rem;
        padding: 6px 10px;
    }

    .popular-sidebar,
    .market-sidebar {
        grid-template-columns: 1fr;
    }

    .pf-summary-grid {
        grid-template-columns: 1fr 1fr;
    }

    .pf-add-form {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .nav-link:not(.nav-login):not(.theme-toggle) {
        font-size: 0.72rem;
        padding: 5px 8px;
    }

    .chart-header-row {
        flex-direction: column;
        align-items: flex-start !important;
        gap: 10px;
    }

    .chart-header-row > div:last-child {
        width: 100%;
        justify-content: space-between;
    }

    .tabs {
        gap: 2px;
    }

    .tab {
        padding: 8px 10px;
        font-size: 0.74rem;
    }

    .pf-summary-grid {
        grid-template-columns: 1fr;
    }

    .pf-position {
        grid-template-columns: 1fr auto;
    }

    .pf-pos-del {
        grid-column: 2;
        grid-row: 1;
    }
}

/* ─── Nav premium / upgrade ─── */
.nav-premium-badge {
    display: inline-flex; align-items: center; gap: 5px;
    font-size: 0.72rem; font-weight: 800; letter-spacing: 0.3px;
    padding: 4px 10px; border-radius: 100px;
    background: linear-gradient(135deg, rgba(109,94,245,0.12), rgba(167,139,250,0.08));
    color: var(--p); border: 1px solid rgba(109,94,245,0.2);
}

.nav-upgrade {
    margin-left: 8px;
    border: 1px solid rgba(109,94,245,0.35) !important;
    color: var(--p) !important;
    border-radius: var(--radius-xs);
    padding: 5px 12px !important;
    font-size: 0.78rem !important;
    font-weight: 600 !important;
    display: inline-flex; align-items: center; gap: 5px;
}
.nav-upgrade:hover { background: rgba(109,94,245,0.06) !important; color: var(--p) !important; transform: none !important; }

/* ─── gate premium button ─── */
.gate-btn--premium {
    background: linear-gradient(135deg, #6d5ef5, #a78bfa);
    color: #fff; border: none; border-radius: var(--radius-sm);
    padding: 12px 24px; font-size: 0.88rem; font-weight: 700;
    cursor: pointer; font-family: inherit;
    display: inline-flex; align-items: center; gap: 7px;
    box-shadow: 0 6px 20px rgba(109,94,245,0.35);
    transition: transform 0.15s, box-shadow 0.15s;
}
.gate-btn--premium:hover { transform: translateY(-2px); box-shadow: 0 12px 32px rgba(109,94,245,0.45); }

/* ─── Upgrade Modal ─── */
.upgrade-modal { max-width: 420px; }

.upgrade-body { padding-top: 4px; }

.upgrade-desc {
    font-size: 0.88rem; color: var(--text-secondary); margin-bottom: 20px; line-height: 1.6;
}

.upgrade-list {
    list-style: none; display: flex; flex-direction: column; gap: 10px; margin-bottom: 24px;
}
.upgrade-list li {
    display: flex; align-items: center; gap: 10px;
    font-size: 0.88rem; color: var(--text-primary);
}
.upgrade-list li i { color: #10b981; font-size: 1rem; flex-shrink: 0; }
.upgrade-list li b { font-weight: 700; }

.upgrade-price {
    font-size: 20px; font-weight: 900; color: var(--text-primary);
    margin-bottom: 16px; letter-spacing: -0.5px;
}
.upgrade-price span { color: var(--p); }

.upgrade-cta {
    display: flex; align-items: center; justify-content: center; gap: 8px;
    width: 100%; padding: 14px;
    border-radius: var(--radius-sm); font-size: 0.95rem; font-weight: 700;
    background: linear-gradient(135deg, var(--p), #a78bfa);
    color: #fff; border: none; cursor: pointer; font-family: inherit;
    box-shadow: 0 8px 24px rgba(109,94,245,0.35);
    transition: transform 0.15s, box-shadow 0.15s;
}
.upgrade-cta:hover { transform: translateY(-2px); box-shadow: 0 14px 36px rgba(109,94,245,0.45); }

.upgrade-note {
    text-align: center; font-size: 0.75rem; color: var(--text-muted); margin-top: 12px;
}

/* ─── Payment toast ─── */
.payment-toast {
    position: fixed; bottom: 28px; left: 50%; transform: translateX(-50%) translateY(80px);
    padding: 14px 24px; border-radius: 12px;
    font-size: 0.88rem; font-weight: 600; color: #fff;
    z-index: 9999; opacity: 0;
    transition: transform 0.35s ease, opacity 0.35s ease;
    white-space: nowrap; max-width: calc(100vw - 48px);
    box-shadow: 0 8px 28px rgba(0,0,0,0.18);
}
.payment-toast--ok { background: linear-gradient(135deg, #6d5ef5, #10b981); }
.payment-toast--fail { background: #ef4444; }
.payment-toast--show { transform: translateX(-50%) translateY(0); opacity: 1; }
