/* === BACKTESTER — Terminal Luxe Theme === */
/* Google Fonts loaded via <link> in base.html for faster parallel download */

/* Reset */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    color-scheme: dark;
    --bg: #08080a;
    --bg-card: #111114;
    --bg-card-hover: #16161a;
    --border: #1e1e24;
    --border-hover: #2a2a32;
    --text: #f0f0f2;
    --text-secondary: #8a8a96;
    --accent: #4a9d7c;
    --accent-hover: #5aad8c;
    --accent-dark: #3d8a6a;
    --danger: #ef4444;
    --blue: #5b8def;
    --radius: 12px;
    --radius-sm: 8px;
    --radius-lg: 12px;
    --container: 980px;
    --shadow-sm: 0 2px 8px rgba(0,0,0,0.3);
    --shadow-md: 0 4px 24px rgba(0,0,0,0.4);
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
    overflow-x: hidden;
    scrollbar-gutter: stable;
}

body {
    background: var(--bg);
    color: var(--text);
    font-family: 'Noto Sans KR', 'Outfit', sans-serif;
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden;
    padding-top: 56px;
}

/* Smooth reveal animation */
@keyframes fadeUp {
    from { opacity: 0; transform: translateY(16px); }
    to { opacity: 1; transform: translateY(0); }
}

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


.animate-in {
    animation: fadeUp 0.5s ease both;
}

.delay-1 { animation-delay: 0.1s; }
.delay-2 { animation-delay: 0.2s; }
.delay-3 { animation-delay: 0.3s; }
.delay-4 { animation-delay: 0.4s; }

/* Container */
.container {
    max-width: var(--container);
    margin: 0 auto;
    padding: 0 20px;
}

/* Navigation */
.nav {
    border-bottom: 1px solid var(--border);
    padding: 14px 0;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: rgba(8, 8, 10, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    z-index: 100;
}

.nav-inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-family: 'Outfit', sans-serif;
    font-size: 18px;
    font-weight: 800;
    letter-spacing: -0.5px;
    color: var(--accent);
    text-decoration: none;
    transition: color 0.3s;
}

.logo:hover {
    color: var(--accent-hover);
}

.nav-links {
    display: flex;
    gap: 24px;
    align-items: center;
    font-size: 14px;
}

.nav-links a {
    color: var(--text-secondary);
    text-decoration: none;
}

.nav-links a.btn-primary {
    color: #fff;
    transition: color 0.2s;
}

.nav-links a:hover {
    color: var(--text);
}

.nav-divider {
    width: 1px;
    height: 16px;
    background: var(--border);
}

.nav-user {
    color: var(--accent) !important;
    font-weight: 600;
}

.btn-nav {
    padding: 6px 16px;
    font-size: 12px;
}

.nav-link-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 14px;
    cursor: pointer;
    font-family: inherit;
    transition: color 0.2s;
}

.nav-link-btn:hover {
    color: var(--text);
}

body.nav-open { overflow: hidden; }

.inline {
    display: inline;
}

/* Hero */
.hero {
    position: relative;
    min-height: calc(100vh - 56px);
    display: flex;
    align-items: center;
    overflow: hidden;
}

.hero h1 {
    font-family: 'Outfit', sans-serif;
    font-size: 3rem;
    font-weight: 800;
    letter-spacing: -2px;
    color: var(--text);
    margin-bottom: 16px;
}

.hero-desc {
    color: var(--text-secondary);
    font-size: 16px;
    line-height: 1.8;
    margin-bottom: 28px;
    animation: fadeUp 0.6s ease 0.2s both;
}

.hero-label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 1px;
    text-transform: uppercase;
    color: var(--accent);
    margin-bottom: 12px;
}

/* Hero chart background */
.hero-chart-bg {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 100%;
    opacity: 0.35;
    pointer-events: none;
}

.hero-bg-svg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: block;
    opacity: 0;
    transition: opacity 0.8s ease;
}

.hero-bg-svg--active {
    opacity: 1;
}

.hero-bg-line {
    stroke-dasharray: 1600;
    stroke-dashoffset: 1600;
}

.hero-bg-svg--active .hero-bg-line {
    animation: heroLineDraw 2s ease forwards;
}

.hero-bg-area {
    opacity: 0;
}

.hero-bg-svg--active .hero-bg-area {
    animation: heroAreaFade 0.8s ease 1.2s forwards;
}

@keyframes heroLineDraw {
    to { stroke-dashoffset: 0; }
}

@keyframes heroAreaFade {
    to { opacity: 1; }
}

/* Hero content overlay */
.hero-content {
    position: relative;
    z-index: 1;
    max-width: 55%;
}


/* Hero metrics bar */
.hero-metrics-float {
    position: absolute;
    z-index: 2;
    bottom: 20px;
    right: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    background: rgba(8, 8, 10, 0.55);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: none;
    border-radius: var(--radius-sm);
    padding: 10px 18px;
}

.hero-float-ticker {
    text-align: center;
}

.hero-float-ticker-name {
    display: block;
    font-size: 13px;
    font-weight: 700;
    color: var(--text);
    font-family: 'Outfit', sans-serif;
    transition: opacity 0.3s ease;
}

.hero-float-ticker-sub {
    display: block;
    font-size: 9px;
    color: var(--text-secondary);
}

.hero-float-divider {
    width: 1px;
    height: 24px;
    background: rgba(255, 255, 255, 0.08);
}

.hero-float-stat {
    text-align: center;
}

.hero-metric-label {
    display: block;
    font-size: 9px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.hero-metric-value {
    display: block;
    font-size: 15px;
    font-weight: 700;
    color: var(--text);
    font-family: 'Outfit', sans-serif;
    transition: opacity 0.4s ease;
}

.hero-metric-value.positive {
    color: var(--accent);
}

.hero-metric-value.negative {
    color: var(--danger);
}

.subtitle {
    color: var(--text-secondary);
    font-size: 14px;
}

/* Features Inline */
.features-inline {
    text-align: center;
    padding: 32px 0 40px;
    color: var(--text-secondary);
    font-size: 14px;
    line-height: 2;
}

.feature-tag {
    color: var(--text);
    font-weight: 500;
}

.feature-sep {
    margin: 0 10px;
    color: var(--text-secondary);
    opacity: 0.4;
}

/* Features Grid */
.features-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin: 48px 0 40px;
}

.feature-card {
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 20px 24px;
    transition: border-color 0.2s;
}

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

.feature-card h3 {
    font-family: 'Outfit', sans-serif;
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 8px;
    position: relative;
    z-index: 1;
}

.feature-card p {
    color: var(--text-secondary);
    font-size: 13px;
    line-height: 1.6;
    position: relative;
    z-index: 1;
}


.hero-cta {
    display: flex;
    gap: 12px;
}

.btn-lg {
    padding: 16px 32px;
    font-size: 15px;
}

/* Stats Strip */
.stats-strip {
    display: flex;
    justify-content: center;
    gap: 48px;
    padding: 40px 0;
    margin: 20px 0;
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
}

.stat-item {
    text-align: center;
}

.stat-number {
    display: block;
    font-family: 'Outfit', sans-serif;
    font-size: 28px;
    font-weight: 600;
    color: var(--text);
}

.stat-label {
    display: block;
    font-size: 11px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-top: 4px;
}

/* CTA Section */
.cta-section {
    text-align: center;
    padding: 60px 0 80px;
    margin-top: 20px;
    position: relative;
}


.cta-section h2 {
    font-family: 'Outfit', sans-serif;
    font-size: 1.8rem;
    font-weight: 700;
    margin-bottom: 8px;
}

.cta-section p {
    color: var(--text-secondary);
    margin-bottom: 24px;
}

/* Page Header */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 32px 0 16px;
}

.page-header h2 {
    font-family: 'Outfit', sans-serif;
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 14px 32px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    font-family: 'Outfit', sans-serif;
    cursor: pointer;
    text-decoration: none;
    border: none;
    transition: all 0.2s;
}

.btn-primary {
    background: var(--accent);
    color: #fff;
    font-weight: 600;
}

.btn-primary:hover {
    background: var(--accent-hover);
}

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

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

.btn-danger {
    background: transparent;
    color: var(--danger);
    border: 1px solid var(--danger);
}

.btn-danger:hover {
    background: var(--danger);
    color: white;
}

.full-width {
    width: 100%;
}

/* Cards */
.page-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 32px;
    margin: 40px 0;
    box-shadow: var(--shadow-sm);
    animation: fadeUp 0.4s ease both;
}

.auth-card {
    max-width: 400px;
    margin: 60px auto;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 32px;
}

.auth-card h2 {
    font-family: 'Outfit', sans-serif;
    margin-bottom: 24px;
}

.auth-link {
    text-align: center;
    margin-top: 16px;
    font-size: 13px;
    color: var(--text-secondary);
}

.auth-link a {
    color: var(--accent);
    text-decoration: none;
}

.field-error {
    color: #ef4444;
    font-size: 12px;
    margin-top: 4px;
}

.input-error {
    border-color: #ef4444;
}

.find-result {
    text-align: center;
    padding: 20px 0;
}

.found-username {
    display: inline-block;
    font-size: 24px;
    font-weight: 700;
    font-family: 'JetBrains Mono', monospace;
    color: var(--accent);
    background: rgba(74, 157, 124, 0.08);
    border: 1px solid rgba(74, 157, 124, 0.2);
    border-radius: var(--radius);
    padding: 12px 24px;
    margin: 12px 0;
}

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

.auth-desc {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 16px;
}

.auth-actions {
    margin-top: 16px;
}

.agree-group {
    margin: 16px 0;
}

.agree-label {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    font-size: 13px;
    color: var(--text-secondary);
    cursor: pointer;
}

.agree-label input[type="checkbox"] {
    margin-top: 2px;
    accent-color: var(--accent);
}

.agree-label a {
    color: var(--accent);
    text-decoration: underline;
}

/* Forms */
.form-group {
    margin-bottom: 16px;
}

.label {
    display: block;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
    margin-bottom: 6px;
    font-family: 'Outfit', sans-serif;
}

.input, select {
    width: 100%;
    padding: 12px 14px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    font-size: 14px;
    font-family: inherit;
    transition: border-color 0.2s;
}

.input:focus, select:focus {
    outline: none;
    border-color: var(--accent);
}

.help {
    display: block;
    font-size: 11px;
    color: var(--text-secondary);
    margin-top: 4px;
}

.error {
    display: block;
    font-size: 12px;
    color: var(--danger);
    margin-top: 4px;
}

.errors {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid var(--danger);
    border-radius: 8px;
    padding: 12px;
    margin-bottom: 16px;
}

/* Metrics Grid */
.metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 12px;
    margin: 24px 0;
}

.metric-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    text-align: center;
    transition: border-color 0.2s;
}

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

.metric-label {
    display: block;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
    font-family: 'Outfit', sans-serif;
}

.metric-value {
    display: block;
    font-size: 28px;
    font-weight: 700;
    margin-top: 4px;
    font-family: 'JetBrains Mono', monospace;
}

/* Charts */
.chart-container {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    margin: 16px 0;
}

.chart-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.chart-container.half {
    margin: 0;
}

/* Tables */
.yearly-table {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    margin: 16px 0;
}

.yearly-table h3 {
    font-family: 'Outfit', sans-serif;
    font-size: 14px;
    margin-bottom: 12px;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-family: 'JetBrains Mono', monospace;
    font-size: 13px;
}

thead tr {
    border-bottom: 1px solid var(--border);
}

th {
    text-align: right;
    padding: 8px 4px;
    font-weight: 500;
    color: var(--text-secondary);
    font-family: 'Outfit', sans-serif;
    font-size: 12px;
}

th:first-child {
    text-align: left;
}

td {
    text-align: right;
    padding: 8px 4px;
    border-bottom: 1px solid rgba(42, 42, 42, 0.5);
}

td:first-child {
    text-align: left;
    color: var(--text);
}

/* Color utilities */
.positive { color: var(--accent); }
.negative { color: var(--danger); }

/* === Result Page === */

/* Hero */
.result-hero {
    margin: 28px 0 0;
    padding: 28px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    animation: fadeUp 0.4s ease both;
    position: relative;
}


.result-hero-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 24px;
}
.result-hero-top > div:first-child {
    flex: 1;
    min-width: 0;
}

.result-title-row {
    display: flex;
    align-items: center;
    gap: 4px;
}

.result-title {
    font-family: 'Outfit', sans-serif;
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 6px;
}

.result-description {
    font-size: 13px;
    color: var(--text-secondary);
    margin: 2px 0 8px;
    line-height: 1.5;
    white-space: pre-wrap;
}

.inline-edit-form {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 10px;
    width: 100%;
}
.inline-title-input {
    font-size: 18px;
    font-weight: 600;
    padding: 8px 12px;
}
.inline-desc-input {
    font-size: 14px;
    padding: 8px 12px;
    resize: vertical;
    min-height: 80px;
}
.inline-edit-actions {
    display: flex;
    gap: 8px;
}

.title-edit-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 14px;
    color: var(--text-secondary);
    padding: 2px 6px;
    border-radius: 4px;
    transition: color .2s, background .2s;
    vertical-align: middle;
    margin-left: 4px;
}
.title-edit-btn:hover {
    color: var(--primary);
    background: var(--bg-secondary);
}


.save-form-with-title {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
}
.save-title-input {
    text-align: center;
    max-width: 100%;
    width: 100%;
    box-sizing: border-box;
}

.result-meta {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
    font-size: 12px;
    color: var(--text-secondary);
}

.meta-dot {
    width: 3px;
    height: 3px;
    border-radius: 50%;
    background: var(--text-secondary);
    opacity: 0.5;
}

/* Hero Metrics - 3 big numbers */
.hero-metrics {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0;
}

.hero-metric {
    flex: 1;
    text-align: center;
    padding: 8px 16px;
}

.hero-metric-divider {
    width: 1px;
    height: 48px;
    background: var(--border);
}

.hm-value {
    display: block;
    font-family: 'JetBrains Mono', monospace;
    font-size: 32px;
    font-weight: 700;
    line-height: 1.2;
}

.hm-label {
    display: block;
    font-size: 11px;
    color: var(--text-secondary);
    margin-top: 4px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    font-family: 'Outfit', sans-serif;
}

/* Sub Metrics */
.sub-metrics {
    display: flex;
    gap: 8px;
    margin: 12px 0 24px;
}

.sub-metric {
    flex: 1;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 14px 16px;
    text-align: center;
}

.sm-label {
    display: block;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    color: var(--text-secondary);
    font-family: 'Outfit', sans-serif;
    margin-bottom: 4px;
}

.sm-value {
    font-family: 'JetBrains Mono', monospace;
    font-size: 16px;
    font-weight: 600;
}

/* Section Titles */
.section-title {
    font-family: 'Outfit', sans-serif;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    color: var(--text-secondary);
    margin-bottom: 10px;
}

/* Composition Bar */
.composition-section {
    margin-bottom: 24px;
}

.composition-bar {
    display: flex;
    height: 8px;
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 12px;
    gap: 2px;
}

.cb-seg {
    height: 100%;
    border-radius: 2px;
    transition: width 0.3s;
}

.composition-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 20px;
}

.cb-legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
}

.cb-dot {
    width: 8px;
    height: 8px;
    border-radius: 2px;
    flex-shrink: 0;
}

.cb-ticker {
    font-family: 'JetBrains Mono', monospace;
    font-weight: 600;
    color: var(--text);
}

.cb-pct {
    font-family: 'JetBrains Mono', monospace;
    color: var(--text-secondary);
}

.cb-val {
    font-family: 'JetBrains Mono', monospace;
    font-size: 11px;
    color: var(--text-secondary);
    opacity: 0.6;
}

/* Chart Sections */
.chart-section {
    margin-bottom: 16px;
}

.chart-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
}

.chart-card-lg {
    padding: 20px;
}

.chart-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 24px;
}

.flex-1 { flex: 1; }

/* Yearly Table v2 */
.yearly-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 4px 16px 16px;
    margin-bottom: 24px;
}

.yearly-table-v2 {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.yearly-table-v2 thead tr {
    border-bottom: 1px solid var(--border);
}

.yearly-table-v2 th {
    text-align: right;
    padding: 10px 8px;
    font-weight: 500;
    color: var(--text-secondary);
    font-family: 'Outfit', sans-serif;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.yearly-table-v2 th:first-child,
.yearly-table-v2 td:first-child {
    text-align: left;
}

.yearly-table-v2 td {
    text-align: right;
    padding: 10px 8px;
    border-bottom: 1px solid rgba(42, 42, 42, 0.4);
    font-size: 13px;
}

.col-year {
    width: 60px;
    font-weight: 600;
    color: var(--text);
}

.col-bar {
    width: 120px;
}

.yr-bar-wrap {
    height: 14px;
    background: rgba(255,255,255,0.03);
    border-radius: 3px;
    overflow: hidden;
}

.yr-bar {
    height: 100%;
    border-radius: 3px;
    transition: width 0.3s;
    opacity: 0.7;
}

/* Save Section */
.save-section {
    margin: 24px 0 16px;
    text-align: center;
}

.save-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 24px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    font-family: 'Outfit', sans-serif;
}

/* Action Bar */
.result-action-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin: 24px 0 12px;
}

.action-bar-left {
    display: flex;
    align-items: center;
    gap: 8px;
}

.action-bar-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

.action-bar-center {
    width: 100%;
    text-align: center;
}

/* Gated Content */
.gated-content {
    position: relative;
    margin: 16px 0 24px;
}

.gated-blur {
    filter: blur(8px);
    pointer-events: none;
    user-select: none;
    opacity: 0.6;
}

.gated-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
}

.gated-cta {
    text-align: center;
    padding: 36px 48px;
    background: rgba(15, 15, 15, 0.92);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.gated-cta h3 {
    font-family: 'Outfit', sans-serif;
    font-size: 18px;
    margin-bottom: 8px;
}

.gated-cta p {
    color: var(--text-secondary);
    font-size: 13px;
    line-height: 1.6;
    margin-bottom: 20px;
}

.gated-buttons {
    display: flex;
    gap: 8px;
    justify-content: center;
}

/* Share Dropdown */
.share-dropdown-wrap {
    position: relative;
}

.share-dropdown {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 6px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 6px;
    min-width: 180px;
    z-index: 200;
    box-shadow: var(--shadow-md);
    animation: fadeUp 0.15s ease;
}

.share-dropdown-wrap.open .share-dropdown {
    display: block;
}

.share-item {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 10px 12px;
    border: none;
    background: none;
    color: var(--text);
    font-size: 13px;
    font-family: inherit;
    cursor: pointer;
    border-radius: var(--radius-sm);
    transition: background 0.15s;
    text-align: left;
}

.share-item:hover {
    background: rgba(255,255,255,0.06);
}

.share-icon {
    width: 20px;
    text-align: center;
    font-weight: 700;
    font-size: 14px;
    color: var(--accent);
    font-family: 'JetBrains Mono', monospace;
}

.share-divider {
    height: 1px;
    background: var(--border);
    margin: 4px 0;
}

.save-badge.saved {
    background: rgba(74, 157, 124, 0.1);
    color: var(--accent);
    border: 1px solid rgba(74, 157, 124, 0.2);
}

.quota-badge {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
    background: rgba(160, 160, 160, 0.1);
    border: 1px solid rgba(160, 160, 160, 0.2);
    padding: 2px 10px;
    border-radius: 12px;
    vertical-align: middle;
}

.status-badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
}

.status-badge.public {
    background: rgba(91, 141, 239, 0.1);
    color: #5b8def;
    border: 1px solid rgba(91, 141, 239, 0.2);
}

.status-badge.private {
    background: rgba(160, 160, 160, 0.1);
    color: var(--text-secondary);
    border: 1px solid rgba(160, 160, 160, 0.2);
}

.save-badge.public {
    background: rgba(91, 141, 239, 0.1);
    color: #5b8def;
    border: 1px solid rgba(91, 141, 239, 0.2);
}

.save-badge.private {
    background: rgba(160, 160, 160, 0.1);
    color: var(--text-secondary);
    border: 1px solid rgba(160, 160, 160, 0.2);
}

.save-login-btn {
    text-align: center;
}

.save-hint {
    font-size: 11px;
    color: var(--text-secondary);
    margin-top: 8px;
}

/* Result Actions */
.result-actions {
    display: flex;
    gap: 12px;
    margin: 8px 0 40px;
}

/* Actions */
.actions {
    margin: 24px 0;
    display: flex;
    gap: 12px;
}

/* Portfolio list */
.portfolio-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
    margin: 24px 0;
}

.portfolio-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    transition: border-color 0.2s;
}

.portfolio-card:hover {
    border-color: var(--text-secondary);
}

.portfolio-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 12px;
}

.portfolio-card h3 {
    font-family: 'Outfit', sans-serif;
    font-size: 14px;
    margin-bottom: 0;
}

.portfolio-date {
    font-size: 11px;
    color: var(--text-secondary);
    font-family: 'JetBrains Mono', monospace;
    white-space: nowrap;
}

.portfolio-assets {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-bottom: 12px;
}

.asset-tag {
    font-size: 11px;
    padding: 3px 8px;
    border-radius: 4px;
    background: rgba(255,255,255,0.05);
    color: var(--text-secondary);
    font-family: 'JetBrains Mono', monospace;
}

.asset-tag small {
    color: var(--accent);
}

.portfolio-metrics-row {
    display: flex;
    gap: 12px;
    padding: 10px 0;
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
    margin-bottom: 12px;
}

.pm {
    flex: 1;
    text-align: center;
}

.pm-label {
    display: block;
    font-size: 10px;
    text-transform: uppercase;
    color: var(--text-secondary);
    font-family: 'Outfit', sans-serif;
}

.pm-value {
    font-family: 'JetBrains Mono', monospace;
    font-size: 14px;
    font-weight: 600;
}

.portfolio-actions {
    display: flex;
    gap: 8px;
}

.portfolio-actions .btn {
    padding: 8px 16px;
    font-size: 12px;
}

.empty-state {
    text-align: center;
    color: var(--text-secondary);
    padding: 60px 0;
}

/* Form Sections */
.form-section {
    margin-bottom: 24px;
    padding-bottom: 24px;
    border-bottom: 1px solid var(--border);
}

.form-section:last-of-type {
    border-bottom: none;
}

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

.form-row {
    display: flex;
    gap: 12px;
}

.form-group.half {
    flex: 1;
}

.label-sub {
    display: block;
    font-size: 11px;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

/* Asset Rows */
.asset-row {
    display: flex;
    gap: 8px;
    align-items: center;
    margin-bottom: 8px;
    animation: fadeIn 0.15s ease;
}

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

.asset-search-col {
    flex: 1;
}

.asset-weight-col {
    width: 80px;
    flex-shrink: 0;
}

.asset-weight-col .input {
    text-align: center;
    font-family: 'JetBrains Mono', monospace;
}

.btn-icon {
    width: 36px;
    height: 36px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text-secondary);
    font-size: 18px;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-icon:hover {
    border-color: var(--danger);
    color: var(--danger);
}

.btn-sm {
    padding: 8px 16px;
    font-size: 12px;
    margin-top: 4px;
}

.weight-total {
    font-family: 'JetBrains Mono', monospace;
    font-size: 13px;
    color: var(--text-secondary);
    padding: 4px 10px;
    border-radius: 6px;
    background: rgba(255,255,255,0.03);
}

.weight-total.valid {
    color: var(--accent);
    background: rgba(74, 157, 124, 0.1);
}

.weight-total.invalid {
    color: var(--danger);
    background: rgba(239, 68, 68, 0.1);
}

/* Autocomplete */
.autocomplete-wrap {
    position: relative;
}

.autocomplete-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    z-index: 200;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 8px;
    margin-top: 4px;
    max-height: 240px;
    overflow-y: auto;
    display: none;
    box-shadow: 0 8px 24px rgba(0,0,0,0.4);
}

.autocomplete-dropdown.show {
    display: block;
}

.ac-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    cursor: pointer;
    transition: background 0.1s;
    font-size: 13px;
}

.ac-item:hover {
    background: rgba(74, 157, 124, 0.08);
}

.ac-ticker {
    font-family: 'JetBrains Mono', monospace;
    font-weight: 600;
    color: var(--accent);
    min-width: 80px;
}

.ac-name {
    color: var(--text);
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ac-type {
    font-size: 10px;
    color: var(--text-secondary);
    background: rgba(255,255,255,0.05);
    padding: 2px 6px;
    border-radius: 4px;
    text-transform: uppercase;
}

.ac-empty {
    padding: 12px;
    text-align: center;
    color: var(--text-secondary);
    font-size: 13px;
}

/* Period Presets */
.period-presets {
    display: flex;
    gap: 6px;
    margin-top: 8px;
}

.preset-btn {
    padding: 6px 14px;
    border-radius: 6px;
    border: 1px solid var(--border);
    background: transparent;
    color: var(--text-secondary);
    font-size: 12px;
    font-family: 'Outfit', sans-serif;
    cursor: pointer;
    transition: all 0.15s;
}

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

.preset-btn.active {
    border-color: var(--accent);
    color: var(--accent);
    background: rgba(74, 157, 124, 0.08);
}

/* Loading Overlay */
.loading-overlay {
    position: fixed;
    inset: 0;
    z-index: 1000;
    background: rgba(15, 15, 15, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
}

.loading-overlay.show {
    opacity: 1;
    pointer-events: all;
}

.loading-card {
    text-align: center;
    padding: 48px;
}

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

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

.loading-card h3 {
    font-family: 'Outfit', sans-serif;
    margin-bottom: 8px;
}

.loading-sub {
    color: var(--text-secondary);
    font-size: 13px;
    margin-bottom: 24px;
}

.loading-steps {
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-items: center;
}

.loading-step {
    font-size: 12px;
    color: var(--text-secondary);
    opacity: 0.4;
    transition: all 0.3s;
    font-family: 'JetBrains Mono', monospace;
}

.loading-step.active {
    opacity: 1;
    color: var(--accent);
}

.loading-step.done {
    opacity: 0.5;
    text-decoration: line-through;
}

/* Preset Portfolios */
.preset-portfolios {
    margin-bottom: 24px;
    padding-bottom: 24px;
    border-bottom: 1px solid var(--border);
}

.preset-portfolio-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin-top: 8px;
}

.portfolio-preset {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 12px 14px;
    text-align: left;
    cursor: pointer;
    transition: all 0.15s;
    font-family: inherit;
    color: var(--text);
}

.portfolio-preset:hover {
    border-color: var(--accent);
    background: rgba(74, 157, 124, 0.04);
}

.portfolio-preset.active {
    border-color: var(--accent);
    background: rgba(74, 157, 124, 0.08);
}

.pp-name {
    display: block;
    font-family: 'Outfit', sans-serif;
    font-weight: 600;
    font-size: 13px;
    margin-bottom: 2px;
}

.pp-desc {
    display: block;
    font-size: 11px;
    color: var(--text-secondary);
}

/* Weight Bar */
.weight-bar-wrap {
    height: 6px;
    background: rgba(255,255,255,0.04);
    border-radius: 3px;
    margin-bottom: 12px;
    overflow: hidden;
}

.weight-bar {
    display: flex;
    height: 100%;
    border-radius: 3px;
    overflow: hidden;
    transition: all 0.2s;
}

.wb-seg {
    height: 100%;
    transition: width 0.2s;
}

.wb-empty {
    background: rgba(255,255,255,0.04);
}

/* Asset Row enhancements */
.asset-color {
    width: 4px;
    height: 36px;
    border-radius: 2px;
    flex-shrink: 0;
}

.asset-search.has-value {
    border-color: rgba(74, 157, 124, 0.3);
}

.weight-input-wrap {
    position: relative;
}

.weight-suffix {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 12px;
    color: var(--text-secondary);
    pointer-events: none;
}

.weight-input-wrap .input {
    padding-right: 28px;
    text-align: right;
}

/* Section actions */
.section-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.btn-text {
    background: none;
    border: none;
    color: var(--accent);
    font-size: 12px;
    font-family: 'Outfit', sans-serif;
    cursor: pointer;
    padding: 4px 0;
    transition: opacity 0.15s;
}

.btn-text:hover {
    opacity: 0.8;
}

.asset-add-row {
    margin-top: 4px;
}

/* Autocomplete badges */
.ac-badge {
    font-size: 9px;
    padding: 1px 5px;
    border-radius: 3px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.ac-badge-us { background: rgba(91,141,239,0.15); color: #5b8def; }
.ac-badge-kr { background: rgba(245,158,11,0.15); color: #f59e0b; }
.ac-badge-global { background: rgba(139,92,246,0.15); color: #8b5cf6; }

.ac-highlight {
    background: rgba(74, 157, 124, 0.12);
}

/* Amount presets */
.amount-presets {
    display: flex;
    gap: 4px;
    margin-top: 6px;
}

.amt-btn {
    flex: 1;
    padding: 4px;
    border: 1px solid var(--border);
    border-radius: 4px;
    background: transparent;
    color: var(--text-secondary);
    font-size: 10px;
    font-family: 'JetBrains Mono', monospace;
    cursor: pointer;
    transition: all 0.15s;
}

.amt-btn:hover { border-color: var(--text-secondary); color: var(--text); }
.amt-btn.active { border-color: var(--accent); color: var(--accent); }

/* Submit section */
.submit-section {
    margin-top: 8px;
}

.submit-summary {
    text-align: center;
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 10px;
    font-family: 'JetBrains Mono', monospace;
    min-height: 18px;
}

.submit-summary.warn { color: var(--danger); }
.submit-summary.ready { color: var(--accent); }

.btn-lg {
    padding: 16px 32px;
    font-size: 15px;
}

.btn-primary:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    transform: none;
}

.mono {
    font-family: 'JetBrains Mono', monospace;
}

.form-title-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.form-title-row h2 {
    font-family: 'Outfit', sans-serif;
    margin: 0;
}

/* === Board === */
.board-sort {
    display: flex;
    gap: 4px;
}

.sort-btn {
    padding: 6px 14px;
    border-radius: 6px;
    font-size: 12px;
    font-family: 'Outfit', sans-serif;
    color: var(--text-secondary);
    text-decoration: none;
    transition: all 0.15s;
}

.sort-btn:hover { color: var(--text); background: rgba(255,255,255,0.04); }
.sort-btn.active { color: var(--accent); background: rgba(74,157,124,0.08); }

.board-filter {
    display: flex;
    gap: 4px;
    margin-bottom: 12px;
}

.filter-btn {
    padding: 5px 12px;
    border-radius: 6px;
    font-size: 12px;
    font-family: 'Outfit', sans-serif;
    color: var(--text-secondary);
    text-decoration: none;
    border: 1px solid var(--border);
    transition: all 0.15s;
}
.filter-btn:hover { color: var(--text); border-color: var(--text-secondary); }
.filter-btn.active { color: var(--accent); border-color: var(--accent); background: rgba(74,157,124,0.08); }

.board-search {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
}

.board-search-input {
    flex: 1;
    max-width: 400px;
}

.search-result-info {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 12px;
}

.search-result-info a {
    color: var(--accent);
    text-decoration: none;
    margin-left: 8px;
}

.board-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 12px;
    margin: 16px 0;
}

.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 4px;
    margin: 28px 0 12px;
    flex-wrap: wrap;
}
.page-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    height: 36px;
    padding: 0 10px;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-secondary);
    background: var(--bg-card);
    border: 1px solid var(--border);
    text-decoration: none;
    transition: all 0.15s;
}
.page-link:hover {
    color: var(--text);
    border-color: var(--border-hover);
    background: var(--bg-card-hover);
}
.page-link.current {
    color: var(--bg);
    background: var(--accent);
    border-color: var(--accent);
    font-weight: 600;
}
.page-ellipsis {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 28px;
    height: 36px;
    color: var(--text-secondary);
    font-size: 0.85rem;
}

.board-card {
    display: flex;
    flex-direction: column;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

.bc-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 16px 0;
}

.bc-user {
    display: flex;
    align-items: center;
    gap: 8px;
}

.bc-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: rgba(74,157,124,0.15);
    color: var(--accent);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 700;
    font-family: 'Outfit', sans-serif;
}

.bc-username {
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
}

.bc-date {
    font-size: 11px;
    color: var(--text-secondary);
    font-family: 'JetBrains Mono', monospace;
}

.bc-title {
    font-family: 'Outfit', sans-serif;
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 6px;
    color: var(--text);
}

.bc-desc {
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 8px;
    line-height: 1.5;
}

.bc-metrics {
    display: flex;
    gap: 8px;
    margin-bottom: 8px;
}

.bcm {
    flex: 1;
    text-align: center;
    padding: 6px 4px;
    background: rgba(255,255,255,0.02);
    border-radius: 6px;
}

.bcm-label {
    display: block;
    font-size: 9px;
    text-transform: uppercase;
    color: var(--text-secondary);
    font-family: 'Outfit', sans-serif;
    letter-spacing: 0.3px;
}

.bcm-value {
    font-family: 'JetBrains Mono', monospace;
    font-size: 13px;
    font-weight: 600;
}

.bc-period {
    font-size: 11px;
    color: var(--text-secondary);
    font-family: 'JetBrains Mono', monospace;
}

.bc-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px;
    border-top: 1px solid var(--border);
    margin-top: auto;
}

.bc-footer.has-actions {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
}

.bc-social {
    display: flex;
    align-items: center;
    gap: 12px;
}

.bc-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    justify-content: center;
}

.bc-stat {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    color: var(--text-secondary);
    font-family: 'JetBrains Mono', monospace;
}

.bc-stat-icon {
    font-size: 13px;
}

/* === Compare === */
.compare-select-form {
    margin-bottom: 24px;
}
.compare-select-sections {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 16px;
}
.compare-select-section {
    background: var(--bg-secondary);
    border-radius: 12px;
    padding: 16px;
    border: 1px solid var(--border);
}
.compare-section-title {
    font-family: 'Outfit', sans-serif;
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 12px;
    color: var(--text);
}
.compare-options {
    display: flex;
    flex-direction: column;
    gap: 6px;
    max-height: 300px;
    overflow-y: auto;
}
.compare-option {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.15s;
}
.compare-option:hover {
    background: rgba(255,255,255,0.04);
}
.compare-checkbox {
    accent-color: var(--accent);
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}
.compare-option-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}
.compare-option-title {
    font-size: 13px;
    font-weight: 500;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.compare-option-meta {
    font-size: 11px;
    color: var(--text-secondary);
}
.compare-empty {
    font-size: 13px;
    color: var(--text-secondary);
}
.compare-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;
}
.compare-limit-hint {
    font-size: 12px;
    color: var(--text-secondary);
}
.compare-results {
    margin-top: 24px;
}
.compare-table-wrap {
    overflow-x: auto;
}
.compare-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}
.compare-table th,
.compare-table td {
    padding: 10px 14px;
    text-align: right;
    border-bottom: 1px solid var(--border);
}
.compare-table th:first-child,
.compare-table td:first-child {
    text-align: left;
    color: var(--text-secondary);
    font-weight: 400;
}
.compare-table th {
    font-weight: 600;
    font-size: 12px;
    color: var(--text);
    white-space: nowrap;
}

.bc-view-btn {
    font-size: 12px;
    color: var(--accent);
    text-decoration: none;
    font-family: 'Outfit', sans-serif;
    font-weight: 600;
    padding: 4px 8px;
    border-radius: 4px;
    transition: all 0.15s;
}

.bc-view-btn:hover {
    background: rgba(74,157,124,0.08);
}
.bc-actions { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
@media (max-width: 768px) {
    .bc-footer { flex-direction: column; align-items: stretch; gap: 8px; }
    .bc-actions { justify-content: flex-end; }
}

/* Like Button */
.like-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 14px;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 6px;
    transition: all 0.15s;
    font-family: inherit;
}

.like-btn:hover { background: rgba(239,68,68,0.08); color: var(--danger); }
.like-btn.liked { color: var(--danger); }
.like-btn.liked .like-icon { color: var(--danger); }
.like-btn.disabled { cursor: default; opacity: 0.5; }

/* Scrap Button */
.scrap-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 16px;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 6px;
    transition: all 0.15s;
    font-family: inherit;
}

.scrap-btn:hover { background: rgba(245,158,11,0.08); color: #f59e0b; }
.scrap-btn.scraped { color: #f59e0b; }
.scrap-btn.scraped .scrap-icon { color: #f59e0b; }

.like-count {
    font-size: 12px;
    font-family: 'JetBrains Mono', monospace;
}

.bc-body {
    display: block;
    padding: 12px 16px;
    color: inherit;
}

.bc-assets {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-bottom: 12px;
}

.asset-tag-sm {
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 3px;
    background: rgba(255,255,255,0.05);
    color: var(--text-secondary);
    white-space: nowrap;
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Share Section */
.share-section {
    margin: 24px 0 16px;
}

.share-form {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: flex-start;
}

.share-desc {
    flex: 1;
    min-width: 200px;
    resize: vertical;
    font-size: 13px;
}

.share-status {
    font-size: 12px;
    color: var(--accent);
    align-self: center;
}

/* Social Section */
.social-section {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    margin: 16px 0;
}

.social-header {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border);
}

.comment-count-label {
    font-size: 13px;
    color: var(--text-secondary);
}

/* Comments */
.comments-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 16px;
}

.comment-item {
    display: flex;
    gap: 10px;
}

.comment-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: rgba(91,141,239,0.15);
    color: #5b8def;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 700;
    font-family: 'Outfit', sans-serif;
    flex-shrink: 0;
}

.comment-body {
    flex: 1;
    min-width: 0;
}



.comment-user {
    font-size: 12px;
    font-weight: 600;
    color: var(--text);
}

.comment-date {
    font-size: 10px;
    color: var(--text-secondary);
    font-family: 'JetBrains Mono', monospace;
}

.comment-delete-form {
    display: inline;
    margin-left: auto;
}

.comment-delete-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 16px;
    cursor: pointer;
    padding: 0 4px;
    line-height: 1;
    opacity: 0;
    transition: all 0.15s;
}

.comment-item:hover .comment-delete-btn {
    opacity: 1;
}

.comment-delete-btn:hover {
    color: var(--danger);
}

.comment-meta {
    display: flex;
    gap: 8px;
    align-items: center;
    margin-bottom: 2px;
}

.comment-text {
    font-size: 13px;
    color: var(--text);
    line-height: 1.5;
    word-break: break-word;
}

.comment-empty {
    text-align: center;
    font-size: 13px;
    color: var(--text-secondary);
    padding: 12px;
}

.comment-form {
    display: flex;
    gap: 8px;
}

.comment-input {
    flex: 1;
}

.comment-login-hint {
    text-align: center;
    font-size: 12px;
    color: var(--text-secondary);
}

.comment-login-hint a {
    color: var(--accent);
    text-decoration: none;
}

/* === Profile === */
.profile-page {
    max-width: 560px;
    margin: 32px auto;
}

.profile-header {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 28px;
}

.profile-avatar {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: rgba(74,157,124,0.15);
    color: var(--accent);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    font-weight: 700;
    font-family: 'Outfit', sans-serif;
    flex-shrink: 0;
}

.profile-username {
    font-family: 'Outfit', sans-serif;
    font-size: 20px;
}

.profile-joined {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 2px;
}

.profile-stats {
    display: flex;
    gap: 8px;
    margin-bottom: 28px;
}

.profile-stat {
    flex: 1;
    text-align: center;
    padding: 16px 8px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 8px;
}

.ps-value {
    display: block;
    font-family: 'JetBrains Mono', monospace;
    font-size: 22px;
    font-weight: 700;
    color: var(--text);
}

.ps-label {
    display: block;
    font-size: 11px;
    color: var(--text-secondary);
    margin-top: 2px;
    text-transform: uppercase;
    font-family: 'Outfit', sans-serif;
}

.profile-section {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    margin-bottom: 12px;
}

.profile-section h3 {
    font-family: 'Outfit', sans-serif;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    color: var(--text-secondary);
    margin-bottom: 12px;
}

.profile-links {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.profile-link {
    padding: 10px 12px;
    border-radius: 6px;
    color: var(--text);
    text-decoration: none;
    font-size: 14px;
    transition: background 0.15s;
}

.profile-link:hover {
    background: rgba(255,255,255,0.04);
}

.profile-danger-zone {
    border-color: rgba(239,68,68,0.2);
}

.danger-desc {
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 12px;
    line-height: 1.5;
}

/* === Legal Pages === */
.legal-page {
    max-width: 720px;
    margin: 32px auto;
    padding: 0 20px;
}

.legal-page h1 {
    font-family: 'Outfit', sans-serif;
    font-size: 24px;
    margin-bottom: 8px;
}

.legal-updated {
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 32px;
}

.legal-page section {
    margin-bottom: 28px;
}

.legal-page h2 {
    font-family: 'Outfit', sans-serif;
    font-size: 16px;
    margin-bottom: 10px;
    color: var(--text);
}

.legal-page p {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.8;
    margin-bottom: 8px;
}

.legal-page ul, .legal-page ol {
    padding-left: 20px;
    margin-bottom: 8px;
}

.legal-page li {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.8;
    margin-bottom: 4px;
}

.legal-page strong {
    color: var(--text);
}

/* === Toast Messages === */
.toast-container {
    position: fixed;
    top: 80px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.toast {
    padding: 12px 24px;
    border-radius: var(--radius);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    animation: toast-in 0.3s ease, toast-out 0.3s ease 3.5s forwards;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
}

.toast-error {
    background: #ef4444;
    color: #fff;
}

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

.toast-info, .toast-warning {
    background: var(--bg-card);
    color: var(--text);
    border: 1px solid var(--border);
}

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

@keyframes toast-out {
    from { opacity: 1; }
    to { opacity: 0; }
}

/* === Footer === */
.footer {
    border-top: 1px solid var(--border);
    padding: 32px 0;
    margin-top: 60px;
}

.footer-inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.footer-brand {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.footer-logo {
    font-family: 'Outfit', sans-serif;
    font-weight: 700;
    font-size: 14px;
    color: var(--accent);
}

.footer-copy {
    font-size: 11px;
    color: var(--text-secondary);
}

.footer-links {
    display: flex;
    gap: 16px;
}

.footer-links a {
    font-size: 12px;
    color: var(--text-secondary);
    text-decoration: none;
    transition: color 0.15s;
}

.footer-links a:hover {
    color: var(--text);
}

.footer-disclaimer {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--border);
    font-size: 11px;
    color: var(--text-secondary);
    line-height: 1.6;
    text-align: center;
    opacity: 0.7;
}

/* === Help Tooltip === */
.help-tip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--border);
    color: var(--text-secondary);
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    margin-left: 6px;
    vertical-align: middle;
    position: relative;
    flex-shrink: 0;
    transition: background 0.15s, color 0.15s;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

.help-tip:hover,
.help-tip.active {
    background: var(--accent);
    color: var(--bg);
}

.help-bubble {
    display: none;
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    top: calc(100% + 8px);
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 12px 14px;
    font-size: 13px;
    font-weight: 400;
    line-height: 1.6;
    color: var(--text);
    width: 280px;
    z-index: 300;
    box-shadow: var(--shadow-md);
    pointer-events: auto;
}

.help-bubble::before {
    content: '';
    position: absolute;
    top: -5px;
    left: 50%;
    transform: translateX(-50%) rotate(45deg);
    width: 8px;
    height: 8px;
    background: var(--bg-card);
    border-left: 1px solid var(--border);
    border-top: 1px solid var(--border);
}

.help-tip.active .help-bubble {
    display: block;
}

.help-bubble-portal {
    display: none;
    position: fixed;
    left: 16px;
    right: 16px;
    bottom: 20px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 12px 14px;
    font-size: 13px;
    font-weight: 400;
    line-height: 1.6;
    color: var(--text);
    z-index: 400;
    box-shadow: var(--shadow-md);
}

.help-bubble strong {
    color: var(--accent);
}

/* Responsive */
/* === Hamburger Button === */
.hamburger {
    display: none;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    z-index: 200;
}

.hamburger span {
    display: block;
    width: 20px;
    height: 2px;
    background: var(--text);
    border-radius: 1px;
    transition: all 0.25s;
}

.hamburger.open span:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
}
.hamburger.open span:nth-child(2) {
    opacity: 0;
}
.hamburger.open span:nth-child(3) {
    transform: rotate(-45deg) translate(5px, -5px);
}

/* === Mobile: 768px === */
@media (max-width: 768px) {
    /* Compare */
    .compare-select-sections { grid-template-columns: 1fr; }

    .compare-table { font-size: 12px; }
    .compare-table th, .compare-table td { padding: 8px 8px; }

    /* Nav */
    .hamburger { display: flex; }

    .nav-links {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        height: calc(100vh - 57px);
        height: calc(100dvh - 57px);
        background: var(--bg);
        flex-direction: column;
        align-items: stretch;
        padding: 16px 20px;
        gap: 4px;
        font-size: 15px;
        z-index: 150;
        border-top: 1px solid var(--border);
        overflow-y: auto;
    }

    .nav-links.open { display: flex; }

    .nav-links a, .nav-link-btn {
        padding: 12px 0;
        font-size: 15px;
        border-bottom: 1px solid var(--border);
    }

    .nav-divider { display: none; }

    .btn-nav {
        text-align: center;
        padding: 12px;
        margin-top: 4px;
    }

    /* Container */
    .container { padding: 0 16px; }

    /* Home */
    .hero {
        height: auto;
        display: block;
        padding: 48px 0 32px;
    }

    .hero h1 { font-size: 2.2rem; }

    .hero-content {
        max-width: 100%;
    }

    .hero-metrics-float {
        position: relative;
        bottom: auto;
        right: auto;
        margin: 0;
        border-radius: 0;
        justify-content: center;
        background: rgba(8, 8, 10, 0.7);
        backdrop-filter: blur(12px);
        -webkit-backdrop-filter: blur(12px);
    }

    .hero-float-ticker-name { font-size: 11px; }
    .hero-metric-value { font-size: 13px; }
    .hero-float-divider { height: 20px; }

    .features-inline {
        padding: 24px 0 32px;
        font-size: 13px;
    }

    .feature-sep { margin: 0 6px; }

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

    .hero-desc { font-size: 14px; }
    .stats-strip { gap: 20px; flex-wrap: wrap; }
    .stat-number { font-size: 22px; }
    .hero-cta { flex-direction: column; align-items: flex-start; }
    .feature-card { padding: 20px 16px; }
    .cta-section { padding: 40px 0 60px; }
    .cta-section h2 { font-size: 1.4rem; }

    /* Backtest Form */
    .page-card { padding: 20px 16px; margin: 20px 0; }
    .preset-portfolio-grid { grid-template-columns: repeat(2, 1fr); }
    .form-row { flex-direction: column; gap: 8px; }
    .asset-row { flex-wrap: wrap; }
    .asset-search-col { flex: 1 1 100%; }
    .asset-weight-col { width: 70px; }
    .period-presets { flex-wrap: wrap; }
    .amount-presets { flex-wrap: wrap; }

    /* Result Page */
    .result-hero { padding: 20px 16px; margin-top: 16px; }
    .result-hero-top { flex-direction: column; gap: 10px; }
    .result-title { font-size: 16px; }
    .result-meta { font-size: 11px; }

    .hero-metrics { flex-direction: column; gap: 4px; }
    .hero-metric { padding: 6px 8px; }
    .hero-metric-divider { width: 60%; height: 1px; margin: 0 auto; }
    .hm-value { font-size: 24px; }
    .hm-label { font-size: 10px; }

    .sub-metrics { flex-wrap: wrap; gap: 6px; }
    .sub-metric { flex: 1 1 45%; padding: 10px 8px; }
    .sm-value { font-size: 14px; }

    .chart-row { grid-template-columns: 1fr; gap: 10px; }
    .chart-card { padding: 12px 8px; }

    .composition-legend { gap: 6px 12px; }
    .cb-legend-item { font-size: 11px; }
    .cb-val { display: none; }

    .yearly-card { padding: 4px 10px 10px; }
    .yearly-table-v2 td, .yearly-table-v2 th { padding: 8px 4px; font-size: 12px; }
    .col-bar { display: none; }

    .result-action-bar { flex-direction: column; gap: 10px; padding: 14px 16px; }
    .action-bar-left, .action-bar-right { justify-content: center; }
    .result-actions { flex-wrap: wrap; justify-content: center; }

    /* Board */
    .page-header { flex-direction: column; align-items: flex-start; gap: 10px; }
    .board-grid { grid-template-columns: 1fr; }
    .bc-metrics { flex-wrap: wrap; gap: 4px; }
    .bcm { flex: 1 1 45%; }

    /* Portfolio List */
    .portfolio-grid { grid-template-columns: 1fr; }

    /* Profile */
    .profile-stats { flex-wrap: wrap; gap: 6px; }
    .profile-stat { flex: 1 1 45%; padding: 12px 4px; }
    .ps-value { font-size: 18px; }

    /* Auth */
    .auth-card { margin: 30px auto; padding: 24px 20px; }

    /* Social */
    .social-section { padding: 14px; }
    .comment-form { flex-direction: column; }
    .comment-form .btn { width: 100%; }

    /* Gated */
    .gated-cta { padding: 24px 20px; }
    .gated-cta h3 { font-size: 15px; }
    .gated-buttons { flex-direction: column; gap: 6px; }

    /* Loading */
    .loading-card { padding: 32px 24px; }

    /* Footer */
    .footer-inner { flex-direction: column; gap: 16px; text-align: center; }

    /* Table overflow containment */
    .yearly-card { overflow-x: auto; -webkit-overflow-scrolling: touch; }

    /* Help tooltip mobile — use portal instead */
    .help-tip.active .help-bubble { display: none; }

    /* Touch targets */
    .ac-item { padding: 14px 12px; font-size: 14px; }
    .btn-icon { width: 44px; height: 44px; font-size: 20px; }
    .sort-btn { padding: 10px 14px; }
    .like-btn, .scrap-btn { padding: 8px 12px; }
    .amt-btn { padding: 8px 4px; }

    /* Comment delete visible on mobile (no hover) */
    .comment-delete-btn { opacity: 0.6; }

    /* Hero CTA full width */
    .hero-cta { width: 100%; align-items: stretch; }
    .hero-cta .btn { width: 100%; text-align: center; }

    /* Hero desc br */
    .hero-desc br { display: none; }

    /* Footer links wrap */
    .footer-links { flex-wrap: wrap; justify-content: center; gap: 8px 16px; }

    /* Asset row cleanup */
    .asset-color { display: none; }
    .asset-row { position: relative; padding-right: 48px; }
    .asset-row .btn-icon.btn-remove {
        position: absolute;
        right: 0;
        top: 50%;
        transform: translateY(-50%);
    }

    /* Share dropdown bottom-sheet */
    .share-dropdown-wrap { position: static; }
    .share-dropdown {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        top: auto;
        border-radius: 16px 16px 0 0;
        min-width: unset;
        padding: 16px;
        margin-top: 0;
        max-height: 60vh;
        overflow-y: auto;
    }

    /* Gated buttons full width */
    .gated-buttons .btn { width: 100%; text-align: center; }
}

@media (max-width: 480px) {
    .container { padding: 0 12px; }
    .page-card { padding: 16px 12px; margin: 12px 0; }

    /* Home */
    .hero h1 { font-size: 1.8rem; letter-spacing: -0.5px; }
    .hero-desc { font-size: 13px; }
    .hero-desc br { display: none; }
    .hero-metrics-float { gap: 10px; padding: 8px 12px; }
    .hero-float-ticker { display: none; }
    .hero-float-divider:first-of-type { display: none; }
    .hero-metric-value { font-size: 12px; }
    .hero-metric-label { font-size: 8px; }
    .features-inline { font-size: 12px; }
    .feature-sep { margin: 0 4px; }

    /* Form */
    .preset-portfolio-grid { grid-template-columns: 1fr; }
    .period-presets { display: grid; grid-template-columns: repeat(3, 1fr); }
    .preset-btn { text-align: center; padding: 10px 6px; }
    .amt-btn { padding: 8px 4px; font-size: 11px; }

    /* Result */
    .hm-value { font-size: 20px; }
    .sub-metric { flex: 1 1 100%; }
    .yearly-table-v2 td, .yearly-table-v2 th { padding: 6px 3px; font-size: 11px; }
    .gated-cta { padding: 20px 12px; }
    .gated-buttons .btn { width: 100%; text-align: center; }

    /* Board */
    .bcm { flex: 1 1 100%; }

    /* Profile */
    .profile-stats { display: grid; grid-template-columns: repeat(2, 1fr); }
    .profile-stat:last-child { grid-column: 1 / -1; }

    /* Footer */
    .footer-links { flex-wrap: wrap; justify-content: center; gap: 8px 16px; }

    /* Legal */
    .legal-page { padding: 0; }
}

/* ── Hub grid ── */
.hub-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    margin: 24px 0;
}
.hub-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 40px 28px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    text-decoration: none;
    color: var(--text);
    transition: all 0.2s;
}
.hub-card:hover {
    border-color: var(--accent);
    background: var(--bg-card-hover);
}
.hub-icon { font-size: 2.5rem; margin-bottom: 16px; opacity: 0.8; }
.hub-card h3 { font-size: 1.2rem; font-weight: 600; margin-bottom: 8px; }
.hub-card p { font-size: 0.9rem; color: var(--text-secondary); margin-bottom: 16px; line-height: 1.5; }
.hub-action { font-size: 0.9rem; color: var(--accent); font-weight: 500; }
.hub-target { display: block; font-size: 0.75rem; color: var(--text-secondary); margin-bottom: 12px; padding-top: 8px; border-top: 1px solid var(--border); line-height: 1.4; }
.hub-login-hint { color: var(--text-secondary); font-size: 0.8rem; }
.page-desc { color: var(--text-secondary); font-size: 0.95rem; margin-top: 4px; }

/* ── Quant form ── */
/* ── Quant form sections ── */
.quant-section { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); margin-bottom: 12px; overflow: hidden; }
.quant-section-title { display: flex; align-items: center; gap: 10px; padding: 16px 20px; cursor: pointer; font-size: 1rem; font-weight: 600; user-select: none; }
.quant-section-title:hover { background: var(--bg-card-hover); }
.section-number { display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 28px; background: var(--accent); color: var(--bg); border-radius: 50%; font-size: 0.85rem; font-weight: 700; }
.section-toggle { margin-left: auto; font-size: 0.8rem; color: var(--text-secondary); }
.quant-section-body { display: none; padding: 0 20px 20px; }
.quant-section-body.open { display: block; }

/* ── Presets ── */
.preset-group { display: flex; flex-wrap: wrap; gap: 8px; }
.preset-btn { padding: 8px 16px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--bg); color: var(--text-secondary); font-size: 0.85rem; cursor: pointer; transition: all 0.15s; }
.preset-btn:hover { border-color: var(--accent); color: var(--text); }
.preset-btn.active { background: var(--accent); color: var(--bg); border-color: var(--accent); font-weight: 600; }
.preset-hint { font-size: 0.8rem; color: var(--text-secondary); margin-top: 10px; }

/* ── Weight bar ── */
.weight-bar-wrap { height: 8px; background: var(--border); border-radius: 4px; overflow: hidden; margin-bottom: 6px; }
.weight-bar { display: flex; height: 100%; }
.weight-bar-seg { height: 100%; transition: width 0.2s; }
.weight-bar-label { text-align: center; font-size: 0.85rem; margin-bottom: 16px; }

/* ── Factor grid (2 columns) ── */
.factor-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.factor-card { background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 16px; transition: opacity 0.2s, border-color 0.2s; }
.factor-card:not(.disabled) { border-color: var(--accent); }
.factor-card.disabled { opacity: 0.5; }
.factor-card.disabled .factor-card-body { display: none; }
.factor-card-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.factor-toggle { display: flex; align-items: center; gap: 8px; cursor: pointer; }
.factor-name { font-weight: 600; font-size: 0.95rem; }
.factor-card-body { }
.factor-weight-row { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.factor-weight-input { width: 48px; padding: 3px 4px; border: 1px solid var(--border); border-radius: var(--radius-sm); font-size: 0.85rem; font-weight: 600; color: var(--accent); text-align: right; background: var(--bg-card); }
.factor-weight-input:focus { outline: none; border-color: var(--accent); }
.factor-weight-input::-webkit-inner-spin-button { opacity: 0; width: 0; }
.weight-unit { font-size: 0.85rem; color: var(--text-secondary); }
.factor-metrics { display: flex; flex-wrap: wrap; gap: 10px; font-size: 0.85rem; color: var(--text-secondary); margin-bottom: 6px; }
.factor-metrics label { display: flex; align-items: center; gap: 4px; cursor: pointer; }

/* ── Factor filters ── */
.factor-filter-detail { margin-top: 8px; }
.factor-filter-detail summary { font-size: 0.8rem; color: var(--text-secondary); cursor: pointer; padding: 4px 0; }
.factor-filter-detail summary:hover { color: var(--text); }
.filter-rows { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; }
.filter-row { display: flex; align-items: center; gap: 6px; }
.filter-label { font-size: 0.8rem; color: var(--text-secondary); min-width: 80px; }
.filter-input { width: 70px; padding: 4px 6px; border: 1px solid var(--border); border-radius: var(--radius-sm); font-size: 0.8rem; background: var(--bg-card); color: var(--text); }
.filter-input::placeholder { color: var(--text-secondary); opacity: 0.6; }
.filter-sep { font-size: 0.8rem; color: var(--text-secondary); }

/* ── Quant form layout ── */
.quant-section .form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 12px; }
.quant-section .form-group { display: flex; flex-direction: column; gap: 6px; }
.quant-section .form-group .slider { max-width: 100%; width: 100%; }

/* ── Common form elements ── */
.slider { -webkit-appearance: none; width: 100%; max-width: 160px; height: 6px; background: var(--border); border-radius: 3px; outline: none; }
.slider::-webkit-slider-thumb { -webkit-appearance: none; width: 18px; height: 18px; border-radius: 50%; background: var(--accent); cursor: pointer; }
.toggle-group { display: flex; gap: 0; border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; }
.toggle-btn { flex: 1; padding: 8px 12px; text-align: center; font-size: 0.85rem; cursor: pointer; background: var(--bg); color: var(--text-secondary); border-right: 1px solid var(--border); transition: all 0.15s; }
.toggle-btn:last-child { border-right: none; }
.toggle-btn:has(input:checked) { background: var(--accent); color: var(--bg); font-weight: 600; }
.toggle-btn input { display: none; }
.tooltip-icon { color: var(--text-secondary); cursor: help; font-size: 0.85rem; }

/* ── Quant result: factor config ── */
.quant-factor-config { margin-bottom: 24px; }
.factor-detail-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; margin-bottom: 16px; }
.factor-detail-card { background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 14px; }
.factor-detail-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.factor-detail-name { font-weight: 600; font-size: 0.95rem; }
.factor-detail-weight { font-size: 1.1rem; font-weight: 700; color: var(--accent); }
.factor-detail-metrics { display: flex; flex-wrap: wrap; gap: 4px; }
.factor-metric-tag { padding: 2px 8px; background: var(--accent-bg, rgba(99,102,241,0.08)); border-radius: var(--radius-sm); font-size: 0.75rem; color: var(--text-secondary); }
.factor-detail-filters { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.factor-filter-tag { padding: 2px 8px; background: rgba(245,158,11,0.1); border-radius: var(--radius-sm); font-size: 0.7rem; color: #b45309; }
.quant-meta-row { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; padding-top: 12px; border-top: 1px solid var(--border); }
.qm-item { font-size: 0.85rem; color: var(--text-secondary); }

/* ── Quant result: current holdings ── */
.quant-holdings { margin-bottom: 24px; }
.holdings-date { font-size: 0.8rem; font-weight: 400; color: var(--text-secondary); margin-left: 8px; }
.holdings-table-wrap { max-height: 400px; overflow-y: auto; margin-bottom: 12px; }
.holdings-table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.holdings-table th { text-align: left; padding: 8px 12px; border-bottom: 2px solid var(--border); font-size: 0.8rem; color: var(--text-secondary); font-weight: 500; }
.holdings-table td { padding: 7px 12px; border-bottom: 1px solid var(--border); }
.holding-ticker { font-size: 0.8rem; color: var(--text-secondary); font-family: monospace; white-space: nowrap; text-align: left; }
.holding-name { font-weight: 500; width: 100%; text-align: left; }
.holding-weight { text-align: right; font-variant-numeric: tabular-nums; color: var(--text-secondary); white-space: nowrap; }
.holdings-table th:last-child,
.holdings-table td:last-child { text-align: right; }
.holdings-footer { display: flex; flex-wrap: wrap; gap: 16px; align-items: center; font-size: 0.85rem; color: var(--text-secondary); }
.market-dist { display: flex; gap: 8px; align-items: center; }
.market-dist-item { font-weight: 600; color: var(--text); }
.next-rebalance { }
.next-rebalance strong { color: var(--accent); }

/* ── Quant result: rebalance analysis ── */
.quant-rebalance { margin-bottom: 24px; }
.rebalance-summary { font-size: 0.8rem; font-weight: 400; color: var(--text-secondary); margin-left: 8px; }
.rebalance-table-wrap { max-height: 360px; overflow-y: auto; margin-bottom: 12px; }
.rebalance-table { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
.rebalance-table th { text-align: left; padding: 8px 10px; border-bottom: 2px solid var(--border); font-size: 0.8rem; color: var(--text-secondary); font-weight: 500; }
.rebalance-table td { padding: 6px 10px; border-bottom: 1px solid var(--border); font-variant-numeric: tabular-nums; }
.rebalance-table th:nth-child(n+2),
.rebalance-table td:nth-child(n+2) { text-align: right; }
.text-positive { color: var(--green); }
.text-negative { color: var(--red); }

/* ── Quant result: selection history detail ── */
.selections-history-detail { margin-top: 12px; background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 12px 16px; }
.selections-history-detail summary { cursor: pointer; font-weight: 500; font-size: 0.9rem; color: var(--text-secondary); }
.selection-entry { margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--border); }
.selection-entry strong { font-size: 0.85rem; color: var(--accent); }
.selection-group { margin-top: 8px; }
.selection-label { display: inline-block; font-size: 0.75rem; font-weight: 600; padding: 2px 8px; border-radius: var(--radius-sm); margin-bottom: 4px; }
.buy-label { background: rgba(34,197,94,0.12); color: var(--green); }
.sell-label { background: rgba(239,68,68,0.12); color: var(--red); }
.hold-label { background: rgba(148,163,184,0.12); color: var(--text-secondary); }
.selection-tickers { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.tag-buy { border-left: 2px solid var(--green); }
.tag-sell { border-left: 2px solid var(--red); }
.tag-hold { border-left: 2px solid var(--border); }
.type-badge { font-size: 0.7rem; padding: 2px 8px; border-radius: 3px; font-weight: 600; vertical-align: middle; }
.type-portfolio { background: rgba(99,102,241,0.12); color: var(--accent); }
.type-quant { background: rgba(16,185,129,0.12); color: var(--green); }
.type-chart { background: rgba(245,158,11,0.12); color: #f59e0b; }
.tag-factor { background: rgba(16,185,129,0.08); border-left: 2px solid var(--green); }
.tag-more { background: var(--bg); color: var(--text-secondary); font-style: italic; }
.removed-badge { font-size: 0.65rem; padding: 1px 5px; background: rgba(239,68,68,0.15); color: var(--red); border-radius: 3px; font-weight: 600; margin-left: 2px; }
.holding-removed { opacity: 0.6; }
.holding-removed .holding-name { text-decoration: line-through; }

/* ── Quant / hub mobile ── */
@media (max-width: 768px) {
    .factor-grid { grid-template-columns: 1fr; }
}
@media (max-width: 600px) {
    .form-row { grid-template-columns: 1fr; }
    .hub-grid { grid-template-columns: 1fr; }
    .slider { max-width: 120px; }
    .filter-label { min-width: 60px; }
    .filter-input { width: 60px; }
}

/* ── Chart backtest form ── */
.condition-list { display: flex; flex-direction: column; gap: 8px; }
.condition-card { background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 14px 16px; position: relative; }
.condition-card-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.condition-type-select { padding: 6px 10px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--bg-card); color: var(--text); font-size: 0.85rem; }
.condition-params { display: flex; flex-wrap: wrap; gap: 10px; }
.condition-param { display: flex; align-items: center; gap: 6px; }
.condition-param label { font-size: 0.8rem; color: var(--text-secondary); white-space: nowrap; }
.condition-param input { width: 65px; padding: 4px 6px; border: 1px solid var(--border); border-radius: var(--radius-sm); font-size: 0.85rem; background: var(--bg-card); color: var(--text); text-align: center; }
.condition-remove { background: none; border: none; color: var(--danger); cursor: pointer; font-size: 1.1rem; padding: 2px 6px; }
.condition-remove:hover { color: var(--text); }
.condition-desc { font-size: 0.78rem; color: var(--text-secondary); margin-bottom: 8px; font-style: italic; }
.condition-and { text-align: center; font-size: 0.75rem; color: var(--text-secondary); font-weight: 600; letter-spacing: 2px; }
.add-condition-btn { display: flex; align-items: center; justify-content: center; gap: 6px; padding: 10px; border: 1px dashed var(--border); border-radius: var(--radius-sm); background: none; color: var(--text-secondary); cursor: pointer; font-size: 0.85rem; width: 100%; }
.add-condition-btn:hover { border-color: var(--accent); color: var(--accent); }
.buy-section .condition-card { border-left: 3px solid var(--accent); }
.sell-section .condition-card { border-left: 3px solid var(--danger); }
.section-label-buy { color: var(--accent); font-weight: 600; }
.section-label-sell { color: var(--danger); font-weight: 600; }
.ticker-search-wrap { position: relative; }
.ticker-search-results { position: absolute; top: 100%; left: 0; right: 0; background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-sm); max-height: 200px; overflow-y: auto; z-index: 10; display: none; }
.ticker-search-results.show { display: block; }
.ticker-search-item { padding: 8px 12px; cursor: pointer; font-size: 0.85rem; }
.ticker-search-item:hover { background: var(--bg-card-hover); }
.ticker-selected { display: flex; align-items: center; gap: 8px; padding: 8px 12px; background: var(--bg); border: 1px solid var(--accent); border-radius: var(--radius-sm); margin-top: 8px; }
.ticker-selected .ticker-code { font-weight: 600; font-family: monospace; }
.ticker-selected .ticker-name { color: var(--text-secondary); }
.ticker-clear { background: none; border: none; color: var(--text-secondary); cursor: pointer; margin-left: auto; }

/* ── Chart backtest result ── */
.chart-metrics-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 24px; }
.chart-metric-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 16px; text-align: center; }
.chart-metric-label { font-size: 0.75rem; color: var(--text-secondary); margin-bottom: 4px; }
.chart-metric-value { font-size: 1.3rem; font-weight: 700; }
.chart-metric-value.positive { color: var(--accent); }
.chart-metric-value.negative { color: var(--danger); }
.chart-metric-sub { font-size: 0.7rem; color: var(--text-secondary); margin-top: 4px; }
.trade-table { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
.trade-table th { text-align: left; padding: 8px 10px; border-bottom: 2px solid var(--border); font-size: 0.8rem; color: var(--text-secondary); font-weight: 500; }
.trade-table td { padding: 6px 10px; border-bottom: 1px solid var(--border); font-variant-numeric: tabular-nums; }
.trade-buy { color: var(--accent); }
.trade-sell { color: var(--danger); }
.strategy-summary { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 16px; margin-bottom: 24px; }
.strategy-conditions { display: flex; gap: 24px; }
.strategy-condition-group { flex: 1; }
.strategy-condition-group h4 { font-size: 0.85rem; margin-bottom: 8px; }
@media (max-width: 768px) { .chart-metrics-grid { grid-template-columns: repeat(2, 1fr); } .strategy-conditions { flex-direction: column; } }

/* ===== V2 Landing — Bloomberg x Linear ===== */
.v2-hero {
    position: relative; min-height: calc(100vh - 56px);
    padding: clamp(40px, 8vh, 80px) 0 calc(clamp(40px, 8vh, 80px) * 0.75);
    overflow: hidden;
    background: radial-gradient(ellipse at 70% 40%, rgba(74,157,124,0.12), transparent 60%), #0a0a0a;
}
.v2-hero-grid {
    position: relative; z-index: 2;
    display: grid; grid-template-columns: 1.1fr 1fr; gap: 60px; align-items: center;
}
.v2-eyebrow {
    display: inline-flex; align-items: center; gap: 10px;
    font-family: var(--font-mono); font-size: 11px; color: var(--accent);
    padding: 6px 12px; border: 1px solid rgba(74,157,124,0.15); border-radius: 999px;
    background: rgba(74,157,124,0.08); margin-bottom: 28px;
}
.v2-eyebrow .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 8px var(--accent); animation: v2-pulse 2s ease infinite; }
@keyframes v2-pulse { 0%,100% { opacity: 1; } 50% { opacity: .3; } }
.v2-hero h1 {
    font-family: 'Outfit', sans-serif; font-size: clamp(2rem, 3.5vw, 3.25rem);
    font-weight: 800; letter-spacing: -2px; line-height: 1.02; margin-bottom: 18px;
    word-break: keep-all; overflow-wrap: break-word;
}
.v2-hero h1 .accent { color: var(--accent); }
.v2-hero h1 .thin { font-weight: 300; font-style: italic; letter-spacing: -4px; color: var(--text-secondary); }
.v2-hero-sub { font-size: 15px; line-height: 1.65; color: var(--text-secondary); max-width: 480px; margin-bottom: 28px; }
.v2-cta-row { display: flex; gap: 14px; align-items: center; margin-bottom: 28px; }
.v2-stats-inline { display: flex; gap: 28px; padding-top: 24px; border-top: 1px solid var(--border); flex-wrap: wrap; }
.v2-stat-inline .v { display: block; font-family: var(--font-mono); font-size: 18px; font-weight: 700; color: var(--text); line-height: 1.1; }
.v2-stat-inline .l { display: block; font-size: 10px; color: var(--text-secondary); text-transform: uppercase; letter-spacing: .6px; margin-top: 4px; }

/* Chart panel */
.v2-chart-panel {
    position: relative; background: linear-gradient(180deg, rgba(20,20,22,0.9), rgba(12,12,14,0.9));
    border: 1px solid var(--border); border-radius: 16px; padding: 24px;
    box-shadow: 0 20px 60px rgba(0,0,0,.5), inset 0 1px 0 rgba(255,255,255,.03);
}
.v2-chart-head { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 20px; }
.v2-chart-title { font-size: 15px; font-weight: 600; margin-bottom: 4px; }
.v2-chart-sub { font-family: var(--font-mono); font-size: 11px; color: var(--text-secondary); }
.v2-chart-summary { display: flex; justify-content: space-between; align-items: flex-end; margin-bottom: 8px; }
.v2-chart-big { font-family: var(--font-mono); font-size: 28px; font-weight: 700; color: var(--accent); line-height: 1.1; letter-spacing: -0.5px; }
.v2-chart-big-sub { font-size: 10px; text-transform: uppercase; letter-spacing: .5px; color: var(--text-secondary); margin-top: 2px; }
.v2-chart-vs { text-align: right; }
.v2-chart-vs-label { font-family: var(--font-mono); font-size: 14px; color: var(--text); }
.v2-chart-vs-value { font-family: var(--font-mono); font-size: 11px; color: var(--accent); }
.v2-chart-svg { width: 100%; height: 200px; display: block; margin-bottom: 16px; }
.v2-chart-legend { display: flex; gap: 16px; font-size: 11px; margin-bottom: 14px; padding-bottom: 14px; border-bottom: 1px solid var(--border); }
.v2-legend-item { display: flex; align-items: center; gap: 6px; color: var(--text-secondary); font-family: var(--font-mono); }
.v2-legend-swatch { display: inline-block; width: 16px; height: 2px; border-radius: 1px; }
.v2-chart-metrics { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.v2-chart-metric .l { display: block; font-size: 9px; text-transform: uppercase; letter-spacing: .4px; color: var(--text-secondary); margin-bottom: 2px; }
.v2-chart-metric .v { font-family: var(--font-mono); font-size: 14px; font-weight: 600; }
.v2-period-chips { display: flex; gap: 4px; background: rgba(0,0,0,.3); border-radius: 6px; padding: 3px; }
.v2-period-chips button { background: transparent; border: none; color: var(--text-secondary); padding: 4px 10px; font-size: 10px; font-family: var(--font-mono); border-radius: 4px; cursor: pointer; transition: all .15s; }
.v2-period-chips button.active { background: rgba(74,157,124,0.15); color: var(--accent); }
.v2-period-chips button:hover { color: var(--text); }

/* Ticker tape */
.v2-ticker-tape {
    border-top: 1px solid var(--border); border-bottom: 1px solid var(--border);
    background: rgba(255,255,255,0.01); overflow: hidden; height: 40px;
    display: flex; align-items: center;
}
.v2-ticker-track { display: flex; gap: 40px; white-space: nowrap; animation: v2-ticker 60s linear infinite; padding-left: 100%; }
@keyframes v2-ticker { to { transform: translateX(-100%); } }
.v2-ticker-item { font-family: var(--font-mono); font-size: 12px; display: inline-flex; align-items: center; gap: 8px; }
.v2-ticker-item strong { color: var(--text); font-weight: 600; }
.v2-ticker-item .pos { color: var(--accent); }
.v2-ticker-item .neg { color: #ef4444; }
.v2-ticker-item .sub { color: var(--text-secondary); font-size: 10px; }

/* V2 sections */
.v2-section { padding: clamp(60px, 10vw, 100px) 0; border-top: 1px solid var(--border); }
.v2-section-head { max-width: 800px; margin-bottom: 48px; }
.v2-section-eyebrow { font-family: var(--font-mono); font-size: 11px; color: var(--accent); letter-spacing: 1.2px; text-transform: uppercase; margin-bottom: 16px; display: block; }
.v2-section-title { font-size: clamp(1.4rem, 2.6vw, 2rem); font-weight: 700; letter-spacing: -1px; line-height: 1.15; margin-bottom: 14px; }
.v2-section-desc { color: var(--text-secondary); font-size: 14px; line-height: 1.65; max-width: 560px; }

/* Preset cards with sparklines */
.v2-preset-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.v2-preset-card {
    position: relative; background: var(--bg-card); border: 1px solid var(--border);
    border-radius: 14px; padding: 24px; overflow: hidden; transition: all .3s;
    cursor: pointer; text-decoration: none; color: var(--text); display: block;
}
.v2-preset-card::before {
    content: ''; position: absolute; inset: 0;
    background: radial-gradient(ellipse at 50% 0%, rgba(74,157,124,0.08), transparent 70%);
    opacity: 0; transition: opacity .3s; pointer-events: none;
}
.v2-preset-card:hover { border-color: var(--accent); transform: translateY(-2px); }
.v2-preset-card:hover::before { opacity: 1; }
.v2-preset-rank {
    position: absolute; top: 16px; right: 16px;
    font-family: var(--font-mono); font-size: 10px; color: var(--text-secondary);
    padding: 3px 8px; border-radius: 4px; background: rgba(255,255,255,.03);
}
.v2-preset-name { font-size: 15px; font-weight: 700; margin-bottom: 4px; letter-spacing: -0.2px; }
.v2-preset-assets { font-family: var(--font-mono); font-size: 11px; color: var(--text-secondary); margin-bottom: 20px; }
.v2-preset-sparkline { height: 50px; margin-bottom: 16px; width: 100%; display: block; }
.v2-preset-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; padding-top: 16px; border-top: 1px solid var(--border); }
.v2-preset-stat .v { display: block; font-family: var(--font-mono); font-size: 15px; font-weight: 700; line-height: 1.1; }
.v2-preset-stat .l { display: block; font-size: 9px; text-transform: uppercase; letter-spacing: .4px; color: var(--text-secondary); margin-top: 2px; }

/* 3-step workflow */
.v2-steps {
    display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px;
    border: 1px solid var(--border); border-radius: 16px; overflow: hidden; background: var(--border);
}
.v2-step { background: var(--bg-card); padding: 36px 32px; transition: background .3s; }
.v2-step:hover { background: rgba(74,157,124,0.04); }
.v2-step-num {
    font-family: var(--font-mono); font-size: 11px; color: var(--accent);
    padding: 4px 10px; border-radius: 4px; background: rgba(74,157,124,0.08);
    display: inline-block; margin-bottom: 20px; letter-spacing: 1px;
}
.v2-step h3 { font-size: 20px; font-weight: 700; margin-bottom: 10px; letter-spacing: -0.3px; }
.v2-step p { color: var(--text-secondary); font-size: 14px; line-height: 1.6; margin-bottom: 16px; }
.v2-step-visual {
    height: 80px; border-radius: 8px; background: rgba(0,0,0,.2); border: 1px solid var(--border);
    padding: 12px; font-family: var(--font-mono); font-size: 11px; color: var(--text-secondary); overflow: hidden;
}
.v2-step-visual .ln { display: flex; justify-content: space-between; padding: 2px 0; }
.v2-step-visual .ln .tk { color: var(--text); }
.v2-step-visual .ln .pct { color: var(--accent); }
.v2-step-visual .ln .pct.neg { color: #ef4444; }

/* Benefits grid */
.v2-benefits {
    display: grid; grid-template-columns: repeat(2, 1fr); gap: 2px;
    background: var(--border); border: 1px solid var(--border); border-radius: 12px; overflow: hidden;
}
.v2-benefit { background: var(--bg-card); padding: 28px 32px; display: flex; gap: 16px; align-items: flex-start; }
.v2-benefit-icon {
    flex-shrink: 0; width: 40px; height: 40px; border-radius: 8px;
    background: rgba(74,157,124,0.08); color: var(--accent);
    display: flex; align-items: center; justify-content: center;
    font-family: var(--font-mono); font-size: 16px; font-weight: 700;
    border: 1px solid rgba(74,157,124,0.15);
}
.v2-benefit h4 { font-size: 15px; font-weight: 600; margin-bottom: 6px; }
.v2-benefit p { color: var(--text-secondary); font-size: 14px; line-height: 1.6; }

/* CTA band */
.v2-cta-band {
    padding: 80px 0; text-align: center;
    background: radial-gradient(ellipse at 50% 50%, rgba(74,157,124,0.08), transparent 70%);
    border-top: 1px solid var(--border);
}
.v2-cta-band h2 { font-size: clamp(1.6rem, 3.2vw, 2.75rem); font-weight: 800; letter-spacing: -1.5px; line-height: 1.05; margin-bottom: 14px; }
.v2-cta-band h2 .accent { color: var(--accent); font-style: italic; font-weight: 300; }
.v2-cta-band p { color: var(--text-secondary); font-size: 15px; margin-bottom: 32px; }

/* Animations */
.animate-in { animation: fadeUp .5s ease both; }

/* V2 responsive */
@media (max-width: 960px) {
    .v2-hero-grid { grid-template-columns: 1fr; gap: 40px; }
}
@media (max-width: 768px) {
    .v2-preset-grid { grid-template-columns: 1fr; }
    .v2-steps { grid-template-columns: 1fr; }
    .v2-benefits { grid-template-columns: 1fr; }
    .v2-chart-metrics { grid-template-columns: repeat(2, 1fr); }
}

/* ===== Advanced settings toggle ===== */
.advanced-toggle {
    display: flex; align-items: center; gap: 8px; cursor: pointer;
    font-size: 0.85rem; color: var(--text-secondary); padding: 12px 0; border: none; background: none;
    width: 100%; text-align: left;
}
.advanced-toggle:hover { color: var(--text); }
.advanced-toggle-icon { transition: transform 0.2s; font-size: 0.7rem; }
.advanced-toggle-icon.open { transform: rotate(90deg); }
.advanced-section { display: none; }
.advanced-section.open { display: block; }

/* ===== Clone button in board/result ===== */
.clone-btn {
    font-size: 0.75rem; color: var(--accent); background: none; border: 1px solid var(--accent);
    border-radius: var(--radius-sm); padding: 4px 10px; cursor: pointer; text-decoration: none;
    transition: background 0.2s, color 0.2s; white-space: nowrap;
}
.clone-btn:hover { background: var(--accent); color: var(--bg); }
