:root {
    --bg-root: #030b18;
    --bg-card: #101b31;
    --bg-card-hover: #182743;
    
    --text-primary: #f8fafc; /* Slate 50 */
    --text-secondary: #b8c8dd;
    --text-muted: #7f94b1;
    
    --border-subtle: #2a3b57;
    --border-active: #47648b;
    
    --accent-buy: #10b981; /* Emerald 500 */
    --accent-buy-dim: rgba(16, 185, 129, 0.1);
    --accent-sell: #ef4444; /* Red 500 */
    --accent-sell-dim: rgba(239, 68, 68, 0.1);
    --accent-hold: #f59e0b; /* Amber 500 */
    --accent-brand: #39c2ff;
    --focus-ring: rgba(57, 194, 255, 0.5);

    --font-sans: 'Manrope', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-display: 'Sora', 'Manrope', -apple-system, BlinkMacSystemFont, sans-serif;
}

.portfolio-section-nav {
    display: flex;
    flex-wrap: nowrap;
    gap: 0;
    margin: 0 0 1.25rem;
    border-bottom: 1px solid rgba(92, 116, 147, 0.22);
    overflow-x: auto;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
}

.portfolio-section-nav::-webkit-scrollbar { display: none; }

.portfolio-section-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.56rem 1rem;
    border: none;
    border-bottom: 2px solid transparent;
    background: transparent;
    color: var(--text-muted);
    font-size: 0.82rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    text-decoration: none;
    white-space: nowrap;
    flex-shrink: 0;
    margin-bottom: -1px;
    transition: color 0.12s, border-color 0.12s;
}

.portfolio-section-link:hover,
.portfolio-section-link:focus-visible {
    color: var(--text-secondary);
    border-bottom-color: rgba(57, 194, 255, 0.3);
    background: transparent;
    transform: none;
}

.portfolio-section-link.active {
    color: #d6f2ff;
    border-bottom-color: rgba(57, 194, 255, 0.75);
    font-weight: 700;
    background: transparent;
    box-shadow: none;
}

.portfolio-page-subtitle {
    max-width: 58ch;
    margin: 0.2rem 0 0;
    color: var(--text-secondary);
    font-size: 0.95rem;
    line-height: 1.5;
}

.accounting-summary-grid,
.evaluator-steps-grid,
.evaluator-detail-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.9rem;
}

.summary-card,
.detail-card,
.evaluator-step-card,
.audit-holding-card,
.accounting-entry-panel,
.accounting-detail-card {
    border: 1px solid var(--border-subtle);
    border-radius: 18px;
    background: linear-gradient(180deg, rgba(11, 19, 32, 0.98), rgba(8, 14, 25, 0.98));
    box-shadow: var(--shadow-soft);
}

.summary-card,
.detail-card,
.evaluator-step-card,
.audit-holding-card {
    padding: 1rem;
}

.summary-card .label {
    display: block;
    color: var(--text-secondary);
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.summary-card .value {
    display: block;
    margin-top: 0.42rem;
    color: var(--text-primary);
    font-size: 1.4rem;
}

.summary-card .meta {
    display: block;
    margin-top: 0.35rem;
    color: var(--text-secondary);
    font-size: 0.85rem;
}

.accounting-controls {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 1rem;
    margin: 1rem 0;
}

.accounting-allocation-card {
    display: grid;
    grid-template-columns: minmax(0, 1.5fr) minmax(280px, 1fr);
    gap: 1rem;
    align-items: start;
    border: 1px solid var(--border-subtle);
    border-radius: 18px;
    background: linear-gradient(180deg, rgba(11, 19, 32, 0.98), rgba(8, 14, 25, 0.98));
    box-shadow: var(--shadow-soft);
    padding: 1rem 1.1rem;
    margin-top: 1rem;
}

.accounting-allocation-card.tone-good {
    border-color: rgba(58, 177, 110, 0.35);
}

.accounting-allocation-card.tone-warn {
    border-color: rgba(208, 158, 53, 0.35);
}

.accounting-allocation-card.tone-risk {
    border-color: rgba(199, 89, 89, 0.35);
}

.allocation-kicker {
    display: inline-block;
    color: var(--text-secondary);
    font-size: 0.77rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.accounting-allocation-copy h3 {
    margin: 0.35rem 0 0;
    color: var(--text-primary);
}

.accounting-allocation-copy p {
    margin: 0.45rem 0 0;
    color: var(--text-secondary);
    max-width: 62ch;
}

.accounting-allocation-metrics,
.accounting-allocation-reasons {
    display: flex;
    flex-wrap: wrap;
    gap: 0.55rem;
}

.accounting-allocation-metrics {
    justify-content: flex-end;
}

.accounting-allocation-reasons {
    grid-column: 1 / -1;
    margin-top: 0.1rem;
}

.accounting-allocation-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    align-items: center;
    gap: 0.75rem;
}

.accounting-allocation-actions select {
    min-width: 200px;
    min-height: 2.8rem;
    border: 1px solid var(--border-subtle);
    border-radius: 12px;
    background: rgba(8, 15, 26, 0.96);
    color: var(--text-primary);
    padding: 0.68rem 0.8rem;
}

.accounting-filter-form,
.accounting-entry-form {
    display: grid;
    gap: 0.9rem;
}

.accounting-filter-form {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    flex: 1;
}

.accounting-filter-form label,
.accounting-entry-form label {
    display: grid;
    gap: 0.35rem;
    color: var(--text-secondary);
    font-size: 0.83rem;
    font-weight: 600;
}

.accounting-filter-form input,
.accounting-filter-form select,
.accounting-entry-form input,
.accounting-entry-form select {
    min-height: 2.8rem;
    border: 1px solid var(--border-subtle);
    border-radius: 12px;
    background: rgba(8, 15, 26, 0.96);
    color: var(--text-primary);
    padding: 0.68rem 0.8rem;
}

.accounting-export-group {
    display: flex;
    flex-wrap: wrap;
    gap: 0.7rem;
}

.accounting-entry-panel {
    margin: 1rem 0;
    overflow: hidden;
}

.accounting-entry-panel summary,
.accounting-detail-card summary {
    list-style: none;
    cursor: pointer;
    padding: 1rem 1.1rem;
    color: var(--text-primary);
    font-weight: 700;
}

.accounting-entry-panel summary::-webkit-details-marker,
.accounting-detail-card summary::-webkit-details-marker {
    display: none;
}

.accounting-entry-form {
    grid-template-columns: repeat(6, minmax(0, 1fr));
    padding: 0 1.1rem 1.1rem;
}

.accounting-entry-note {
    grid-column: span 2;
}

.accounting-secondary-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
    margin-top: 1rem;
}

.accounting-detail-card {
    overflow: hidden;
}

.accounting-summary-grid .summary-card.tone-good {
    border-color: rgba(58, 177, 110, 0.35);
    background: linear-gradient(180deg, rgba(16, 39, 31, 0.92), rgba(11, 21, 34, 0.96));
}

.accounting-summary-grid .summary-card.tone-warn {
    border-color: rgba(208, 158, 53, 0.35);
    background: linear-gradient(180deg, rgba(43, 33, 15, 0.92), rgba(11, 21, 34, 0.96));
}

.accounting-summary-grid .summary-card.tone-risk {
    border-color: rgba(199, 89, 89, 0.35);
    background: linear-gradient(180deg, rgba(43, 20, 20, 0.92), rgba(11, 21, 34, 0.96));
}

.accounting-source-chip {
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    padding: 0.28rem 0.58rem;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    background: rgba(25, 39, 61, 0.9);
    color: #d7e6f7;
}

.accounting-source-chip.source-ledger { background: rgba(20, 69, 90, 0.88); }
.accounting-source-chip.source-trade { background: rgba(88, 59, 17, 0.88); }
.accounting-source-chip.source-dividend { background: rgba(20, 87, 58, 0.88); }

.evaluator-steps-section,
.evaluator-holdings-section,
.accounting-history-section,
.evaluator-history-section {
    margin-top: 1rem;
}

.evaluator-delta-section {
    margin-top: 1rem;
}

.evaluator-holding-diff-grid {
    display: grid;
    gap: 1rem;
    margin-top: 1rem;
}

.evaluator-diff-group h4 {
    margin: 0 0 0.7rem;
    color: var(--text-primary);
    font-size: 0.98rem;
}

.field-help {
    margin: 0.45rem 0 0;
    color: var(--text-secondary);
    font-size: 0.82rem;
    line-height: 1.45;
}
.field-help-ledger {
    color: var(--accent, rgba(57,194,255,0.9));
    background: rgba(57,194,255,0.07);
    border-radius: 4px;
    padding: 0.25rem 0.5rem;
}

.assignment-status-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-top: 0.55rem;
    padding: 0.62rem 0.75rem;
    border-radius: 10px;
    border: 1px solid rgba(74, 95, 129, 0.38);
    background: rgba(12, 23, 38, 0.7);
}

.assignment-status-card.compact {
    padding: 0.52rem 0.68rem;
}

.assignment-status-card.tone-good {
    border-color: rgba(58, 177, 110, 0.34);
    background: rgba(20, 47, 36, 0.62);
}

.assignment-status-card.tone-warn {
    border-color: rgba(208, 158, 53, 0.34);
    background: rgba(52, 38, 14, 0.62);
}

.assignment-status-copy {
    display: grid;
    gap: 0.16rem;
    min-width: 0;
}

.assignment-status-copy strong,
.assignment-status-copy span {
    min-width: 0;
    overflow-wrap: anywhere;
}

.assignment-status-copy strong {
    font-size: 0.83rem;
    color: var(--text-primary);
}

.assignment-status-copy span {
    font-size: 0.74rem;
    color: var(--text-secondary);
}

.assignment-status-card a {
    color: var(--accent-soft);
    font-size: 0.74rem;
    font-weight: 700;
    text-decoration: none;
    white-space: nowrap;
}

.assignment-status-card a:hover {
    color: var(--text-primary);
}

.portfolio-page .accounting-entry-form .assignment-status-card {
    margin-top: 0.48rem;
}

.accounting-row-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
    margin-top: 0.55rem;
}

.accounting-row-actions .tx-inline-form {
    margin: 0;
}

.btn-inline {
    min-height: 34px;
    padding: 0.42rem 0.72rem;
    font-size: 0.76rem;
    line-height: 1.1;
}

.evaluator-step-card.tone-good,
.audit-holding-card.tone-good { border-color: rgba(58, 177, 110, 0.35); }
.evaluator-step-card.tone-warn,
.audit-holding-card.tone-warn { border-color: rgba(208, 158, 53, 0.35); }
.evaluator-step-card.tone-risk,
.audit-holding-card.tone-risk { border-color: rgba(199, 89, 89, 0.35); }

.evaluator-step-title,
.audit-step-row-title {
    display: block;
    color: var(--text-secondary);
    font-size: 0.77rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.evaluator-step-value,
.audit-step-row-value {
    display: block;
    margin-top: 0.38rem;
    color: var(--text-primary);
    font-size: 1rem;
}

.evaluator-step-detail,
.audit-step-row-detail,
.table-note {
    display: block;
    margin-top: 0.32rem;
    color: var(--text-secondary);
    font-size: 0.84rem;
    line-height: 1.5;
}

.detail-chip-row,
.audit-holding-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.55rem;
}

.detail-chip {
    display: inline-flex;
    align-items: center;
    min-height: 2rem;
    border-radius: 999px;
    padding: 0.34rem 0.68rem;
    background: rgba(20, 31, 48, 0.92);
    border: 1px solid rgba(81, 104, 138, 0.3);
    color: #d7e6f8;
    font-size: 0.78rem;
    font-weight: 600;
}

.detail-chip.freshness-fresh,
.holding-replacement-chip.freshness-fresh {
    border-color: rgba(16, 185, 129, 0.32);
    color: #86efac;
}

.detail-chip.freshness-aging,
.holding-replacement-chip.freshness-aging {
    border-color: rgba(245, 158, 11, 0.34);
    color: #fcd34d;
}

.detail-chip.freshness-stale,
.holding-replacement-chip.freshness-stale {
    border-color: rgba(248, 113, 113, 0.34);
    color: #fca5a5;
}

.detail-list {
    margin: 0;
    padding-left: 1.15rem;
    color: var(--text-secondary);
}

.audit-holdings-stack {
    display: grid;
    gap: 1rem;
}

.audit-holding-header {
    display: flex;
    align-items: start;
    justify-content: space-between;
    gap: 1rem;
}

.audit-holding-header h4 {
    margin: 0;
    color: var(--text-primary);
}

.audit-step-list {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 0.8rem;
    margin-top: 1rem;
}

.audit-step-row {
    border-radius: 14px;
    border: 1px solid rgba(81, 104, 138, 0.28);
    background: rgba(13, 23, 37, 0.92);
    padding: 0.82rem;
}

.evaluator-history-table td {
    vertical-align: top;
}

.evaluator-history-detail-row td {
    padding-top: 0;
    border-top: none;
}

.evaluator-raw-section {
    margin-top: 1rem;
}

.json-panel {
    padding: 0 1rem 1rem;
}

.json-panel pre {
    margin: 0;
    padding: 1rem;
    overflow: auto;
    border-radius: 14px;
    background: rgba(8, 15, 26, 0.96);
    border: 1px solid rgba(81, 104, 138, 0.24);
    color: #d7e6f8;
    font-size: 0.8rem;
    line-height: 1.55;
    white-space: pre-wrap;
    word-break: break-word;
}

@media (max-width: 900px) {
    .portfolio-section-nav {
        margin-bottom: 1rem;
    }

    .accounting-summary-grid,
    .evaluator-steps-grid,
    .evaluator-detail-grid,
    .accounting-allocation-card,
    .accounting-secondary-grid,
    .audit-step-list,
    .accounting-filter-form,
    .accounting-entry-form {
        grid-template-columns: 1fr;
    }

    .accounting-controls,
    .audit-holding-header {
        flex-direction: column;
        align-items: stretch;
    }

    .accounting-allocation-metrics {
        justify-content: flex-start;
    }

    .accounting-allocation-actions,
    .accounting-allocation-actions select {
        width: 100%;
        min-width: 0;
        justify-content: stretch;
    }

    .accounting-entry-note {
        grid-column: auto;
    }
}

body {
    background-color: var(--bg-root);
    background-image: radial-gradient(circle at 50% -20%, #1e293b 0%, #020617 80%);
    color: var(--text-primary);
    font-family: var(--font-sans);
    -webkit-font-smoothing: antialiased;
    margin: 0;
    line-height: 1.6;
    min-height: 100vh;
}

body.index-page-bg {
    background-color: var(--bg-root);
    background-image:
        linear-gradient(180deg, rgba(2, 6, 23, 0.58) 0%, rgba(2, 6, 23, 0.72) 44%, rgba(2, 6, 23, 0.9) 100%),
        radial-gradient(circle at 50% -18%, rgba(30, 41, 59, 0.65) 0%, rgba(2, 6, 23, 0.95) 78%),
        url('/assets/img/background.png');
    background-repeat: no-repeat, no-repeat, no-repeat;
    background-size: cover, cover, cover;
    background-position: center top, center top, center top;
}

.skip-link {
    position: absolute;
    left: -9999px;
    top: 0;
    z-index: 3000;
    background: var(--text-primary);
    color: var(--bg-root);
    padding: 0.6rem 0.9rem;
    border-radius: 8px;
    font-weight: 700;
    text-decoration: none;
}

.skip-link:focus {
    left: 1rem;
    top: 1rem;
}

h1, h2, h3 { margin: 0; font-weight: 700; letter-spacing: -0.025em; font-family: var(--font-display); }
.container { max-width: 1200px; margin: 0 auto; padding: 0 1.5rem; }

/* Header */
header {
    border-bottom: 1px solid var(--border-subtle);
    background: linear-gradient(180deg, rgba(7, 13, 27, 0.95) 0%, rgba(7, 13, 27, 0.86) 100%);
    backdrop-filter: blur(12px);
    position: sticky;
    top: 0;
    z-index: 50;
}

.header-inner {
    max-width: 1400px;
    margin: 0 auto;
    min-height: 70px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 2rem;
}

.mobile-menu-toggle {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
    z-index: 1000;
}

.mobile-top-actions,
.mobile-lang-shortcut,
.mobile-auth-shortcut,
.nav-mobile-auth,
.nav-mobile-head {
    display: none;
}

.nav-link-icon,
.nav-mobile-section-label {
    display: none;
}

.mobile-nav-overlay {
    display: none;
}

.nav-mobile-close {
    background: transparent;
    border: 1px solid transparent;
    color: var(--text-secondary);
    width: 34px;
    height: 34px;
    border-radius: 8px;
    font-size: 1.3rem;
    line-height: 1;
    cursor: pointer;
}

.nav-mobile-close:hover {
    color: var(--text-primary);
    border-color: var(--border-subtle);
}

.mobile-menu-toggle .bar {
    display: block;
    width: 25px;
    height: 2px;
    background: white;
    margin: 5px 0;
    transition: 0.3s;
}

.main-nav {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    flex-grow: 1;
    margin-left: 3rem;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.nav-utils {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    margin-left: auto;
}

.nav-auth {
    display: flex;
    align-items: center;
    margin-left: 1rem;
}

.nav-auth .nav-btn {
    margin-left: 0;
}
.header-stock-search {
    position: relative;
    width: min(320px, 36vw);
}
.header-stock-search input {
    width: 100%;
    min-height: 38px;
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: 10px;
    color: var(--text-primary);
    padding: 0.5rem 0.7rem 0.5rem 2rem;
    font-size: 0.86rem;
    font-family: var(--font-sans);
    outline: none;
}
.header-stock-search input:focus {
    border-color: var(--border-active);
    box-shadow: 0 0 0 2px rgba(255,255,255,0.05);
}
.header-stock-search input::placeholder {
    color: var(--text-muted);
}
.header-search-icon {
    color: var(--text-muted);
    position: absolute;
    left: 0.65rem;
    top: 50%;
    transform: translateY(-50%);
    pointer-events: none;
}
.header-search-suggestions {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    background: var(--bg-card);
    border: 1px solid var(--border-active);
    border-radius: 10px;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.5);
    z-index: 120;
    display: none;
    overflow: hidden;
}

.market-status {
    display: flex; align-items: center; gap: 0.5rem; font-size: 0.875rem; color: var(--text-secondary);
    background: var(--bg-card); padding: 0.25rem 0.75rem; border-radius: 99px; border: 1px solid var(--border-subtle);
}

.status-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--accent-buy);
    box-shadow: 0 0 0 5px rgba(16, 185, 129, 0.15);
}

@media (max-width: 1024px) {
    .main-nav { margin-left: 1.5rem; }
    .nav-links { gap: 1rem; }
    .header-stock-search { width: min(250px, 34vw); }
}

@media (max-width: 900px) {
    html, body {
        overflow-x: hidden;
    }

    .mobile-top-actions {
        display: inline-flex;
        align-items: center;
        gap: 0.4rem;
        margin-left: auto;
        margin-right: 0.45rem;
    }

    body.index-page-bg {
        background-position: center top, center top, 62% top;
    }

    .mobile-lang-shortcut {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        margin-left: 0;
        margin-right: 0;
        min-height: 36px;
        min-width: 42px;
        border-radius: 999px;
        padding: 0.34rem 0.58rem;
        text-decoration: none;
        font-size: 0.74rem;
        font-weight: 800;
        letter-spacing: 0.03em;
        border: 1px solid rgba(147, 197, 253, 0.45);
        color: #e8f4ff;
        background: rgba(30, 64, 175, 0.22);
    }

    .mobile-auth-shortcut {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        margin-left: 0;
        margin-right: 0;
        border-radius: 999px;
        padding: 0.36rem 0.7rem;
        min-height: 36px;
        min-width: 74px;
        text-decoration: none;
        font-size: 0.75rem;
        font-weight: 700;
        letter-spacing: 0.02em;
        border: 1px solid var(--border-active);
        color: var(--text-primary);
        background: rgba(255, 255, 255, 0.04);
    }

    .mobile-auth-shortcut.login {
        border-color: rgba(147, 197, 253, 0.48);
        background: rgba(30, 64, 175, 0.2);
        color: #e8f4ff;
    }

    .mobile-auth-shortcut.logout {
        border-color: rgba(248, 113, 113, 0.45);
        background: rgba(127, 29, 29, 0.24);
        color: #fecaca;
    }

    .mobile-auth-shortcut.account {
        border-color: rgba(110, 231, 183, 0.45);
        background: rgba(6, 95, 70, 0.25);
        color: #d1fae5;
    }

    .mobile-menu-toggle {
        display: block;
    }

    .mobile-menu-toggle.active .bar:nth-child(1) { transform: translateY(7px) rotate(45deg); }
    .mobile-menu-toggle.active .bar:nth-child(2) { opacity: 0; }
    .mobile-menu-toggle.active .bar:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

    .main-nav {
        position: fixed;
        top: 0;
        right: 0;
        width: min(88%, 390px);
        height: 100vh;
        background: linear-gradient(180deg, #0b1222 0%, #111c33 100%);
        flex-direction: column;
        justify-content: flex-start;
        padding: calc(0.7rem + env(safe-area-inset-top)) 1rem 1rem;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        transform: translateX(100%);
        transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
        z-index: 999;
        margin: 0;
        border-left: 1px solid var(--border-subtle);
        box-shadow: -10px 0 30px rgba(0,0,0,0.5);
    }

    .main-nav.active {
        transform: translateX(0);
    }

    .mobile-nav-overlay {
        display: block;
        position: fixed;
        inset: 0;
        background: rgba(2, 6, 23, 0.58);
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.2s ease;
        z-index: 998;
        backdrop-filter: blur(2px);
    }

    .mobile-nav-overlay.active {
        opacity: 1;
        pointer-events: auto;
    }

    .nav-mobile-auth {
        display: grid;
        width: 100%;
        gap: 0.55rem;
        margin-top: 0.35rem;
        padding-bottom: 0.85rem;
        margin-bottom: 0.45rem;
        border-bottom: 1px solid var(--border-subtle);
    }

    .nav-mobile-auth .nav-mobile-auth-btn {
        width: 100%;
        margin: 0;
        min-height: 46px;
        justify-content: center;
        text-align: center;
        border-radius: 10px;
        font-size: 0.93rem;
    }

    .nav-mobile-head {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 0.75rem;
        padding-bottom: 0.7rem;
        border-bottom: 1px solid var(--border-subtle);
    }

    .nav-mobile-title {
        font-size: 0.72rem;
        letter-spacing: 0.11em;
        text-transform: uppercase;
        color: var(--text-muted);
        font-weight: 700;
    }

    .nav-mobile-section-label {
        display: block;
        font-size: 0.66rem;
        letter-spacing: 0.11em;
        text-transform: uppercase;
        color: var(--text-muted);
        font-weight: 700;
        padding: 0 0.2rem;
    }

.nav-mobile-account-label {
    margin-top: 0.35rem;
    margin-bottom: 0.2rem;
}

    .nav-mobile-main-label {
        margin-bottom: 0.2rem;
    }

    .nav-mobile-language-label {
        margin-bottom: 0.05rem;
    }

    .nav-links {
        flex-direction: column;
        align-items: flex-start;
        width: 100%;
        gap: 0.12rem;
    }

    .nav-link {
        display: flex;
        align-items: center;
        gap: 0.62rem;
        width: 100%;
        padding: 0.8rem 0.8rem;
        margin: 0;
        font-size: 1rem;
        border: 1px solid transparent;
        border-radius: 10px;
    }

    .nav-link-icon {
        display: inline-flex;
        width: 1.25rem;
        height: 1.25rem;
        align-items: center;
        justify-content: center;
        color: var(--text-secondary);
        flex: 0 0 auto;
    }

    .nav-link-icon svg {
        width: 1.05rem;
        height: 1.05rem;
        stroke: currentColor;
        fill: none;
        stroke-width: 2;
        stroke-linecap: round;
        stroke-linejoin: round;
    }

    .nav-link.active .nav-link-icon {
        color: #d6efff;
    }

    .nav-link-text {
        display: inline-block;
        min-width: 0;
    }

    .nav-link.active {
        background: rgba(57, 194, 255, 0.14);
        border-color: rgba(57, 194, 255, 0.34);
    }

    .nav-btn {
        width: 100%;
        margin: 1rem 0 0 0;
        text-align: center;
        padding: 0.75rem;
        justify-content: center;
    }

    .nav-utils {
        margin-top: 0.55rem;
        padding-top: 0.75rem;
        border-top: 1px solid var(--border-subtle);
        width: 100%;
        flex-direction: column;
        align-items: flex-start;
        gap: 0.8rem;
    }

    .nav-auth {
        display: none;
    }

    .header-stock-search {
        width: 100%;
        margin-bottom: 0;
    }

    .nav-auth .nav-btn {
        width: 100%;
        margin: 0;
        justify-content: center;
    }

    .lang-switcher {
        margin: 0;
        font-size: 0.95rem;
    }

    .nav-lang-group {
        width: 100%;
        display: flex;
        flex-direction: column;
        align-items: flex-start;
        gap: 0.35rem;
    }

    .hide-mobile { display: none; }
    
    body.menu-open {
        overflow: hidden;
    }
}

.logo { font-size: 1.25rem; font-weight: 900; letter-spacing: -0.05em; display: flex; align-items: center; gap: 0.5rem; color: #fff; text-decoration: none; font-family: var(--font-display);}
.beta-tag {
    font-size: 0.6rem;
    letter-spacing: 0.08em;
    border: 1px solid var(--border-active);
    border-radius: 999px;
    padding: 0.15rem 0.4rem;
    color: var(--text-secondary);
}
.logo:focus-visible,
.nav-link:focus-visible,
.nav-btn:focus-visible,
.btn-primary:focus-visible,
.btn-secondary:focus-visible,
.btn-outline:focus-visible {
    outline: 2px solid var(--accent-brand);
    outline-offset: 2px;
}
.lang-switcher {
    display: flex;
    align-items: center;
    margin-left: 0.75rem;
    border: 1px solid var(--border-subtle);
    background: rgba(255, 255, 255, 0.03);
    border-radius: 999px;
    padding: 0.16rem 0.26rem;
}
.nav-lang-group {
    display: flex;
    align-items: center;
}
.lang-switcher .divider { color: var(--border-active); margin: 0 0.22rem; }
.lang-switcher a {
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 700;
    font-size: 0.76rem;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 1.5rem;
    min-width: 1.7rem;
    padding: 0.14rem 0.32rem;
    border-radius: 999px;
}
.lang-switcher a.active {
    color: var(--text-primary);
    background: rgba(57, 194, 255, 0.2);
    box-shadow: inset 0 0 0 1px rgba(57, 194, 255, 0.35);
}

.nav-btn {
    border: 1px solid #f8fafc;
    background: #f8fafc;
    color: #020617;
    text-decoration: none;
    font-weight: 700;
    font-size: 0.84rem;
    padding: 0.3rem 0.8rem;
    border-radius: 6px;
    margin-left: 1rem;
}
.nav-btn:hover {
    border-color: #e2e8f0;
    background: #e2e8f0;
    color: #020617;
    text-decoration: none;
}

.nav-link, .nav-btn {
    min-height: 40px;
    display: inline-flex;
    align-items: center;
}

/* Hero */
.hero { padding: 4.25rem 0.5rem 2.8rem; text-align: center; max-width: 760px; margin: 0 auto; }
.hero h1 { font-size: clamp(2rem, 5.5vw, 3.2rem); background: linear-gradient(to bottom right, #fff, #94a3b8); -webkit-background-clip: text; color: transparent; margin-bottom: 0.9rem; line-height: 1.12; }
.subtitle { color: var(--text-secondary); font-size: clamp(1rem, 2.8vw, 1.2rem); margin: 0 auto 1.6rem; font-weight: 400; max-width: 60ch; }

.home-page .hero {
    background:
        linear-gradient(155deg, rgba(14, 24, 45, 0.95) 0%, rgba(6, 12, 26, 0.92) 58%),
        radial-gradient(circle at 0% 0%, rgba(57, 194, 255, 0.2) 0%, rgba(57, 194, 255, 0) 48%);
    border: 1px solid var(--border-active);
    border-radius: 20px;
    padding: 3rem 1.4rem 2.3rem;
    box-shadow: 0 24px 56px rgba(0, 0, 0, 0.34);
    position: relative;
    overflow: hidden;
}

.home-page .hero::before {
    content: "";
    position: absolute;
    inset: 0;
    background:
        linear-gradient(to right, rgba(255,255,255,0.06) 1px, transparent 1px),
        linear-gradient(to bottom, rgba(255,255,255,0.04) 1px, transparent 1px);
    background-size: 34px 34px;
    opacity: 0.22;
    pointer-events: none;
}

.home-page .hero h1 {
    background: linear-gradient(130deg, #f8fafc 10%, #cfe7fb 52%, #67c5f5 100%);
    -webkit-background-clip: text;
}

.home-signature {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 0.55rem;
    margin-bottom: 0.85rem;
}

.home-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    border: 1px solid var(--border-active);
    padding: 0.33rem 0.72rem;
    font-size: 0.72rem;
    letter-spacing: 0.04em;
    color: #d0def0;
    font-weight: 700;
    text-transform: uppercase;
    background: rgba(255, 255, 255, 0.045);
}

.home-pill.home-pill-primary {
    color: #eaf6ff;
    border-color: rgba(57, 194, 255, 0.65);
    background: rgba(57, 194, 255, 0.24);
}

.home-signal-note {
    margin: -0.4rem auto 1rem;
    color: var(--text-secondary);
    font-size: 0.9rem;
    max-width: 58ch;
}

@keyframes riseFade {
    from {
        opacity: 0;
        transform: translateY(12px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.home-page .hero { animation: riseFade 480ms ease-out both; }
.home-page .utility-point { animation: riseFade 600ms ease-out both; }
.home-page .home-workflow-item { animation: riseFade 700ms ease-out both; }

@media (prefers-reduced-motion: reduce) {
    .home-page .hero,
    .home-page .utility-point,
    .home-page .home-workflow-item {
        animation: none;
    }
}

@media (max-width: 768px) {
    .hero { padding: 2.6rem 0.2rem 2rem; }
    .subtitle { margin-bottom: 1.2rem; }
}

/* Search */
.search-box {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: 12px;
    display: flex; align-items: center;
    padding: 0.75rem 1rem;
    transition: border-color 0.2s, box-shadow 0.2s;
    max-width: 560px; margin: 0 auto;
    position: relative;
    width: 100%;
}

.search-suggestions {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    right: 0;
    background: var(--bg-card);
    border: 1px solid var(--border-active);
    border-radius: 12px;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.5);
    z-index: 100;
    display: none;
    overflow: hidden;
}

.suggestion-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1rem;
    cursor: pointer;
    transition: background 0.2s;
    border-bottom: 1px solid var(--border-subtle);
    text-decoration: none;
    color: inherit;
}

.suggestion-item:last-child { border-bottom: none; }
.suggestion-item:hover { background: var(--bg-card-hover); }

.s-info { display: flex; flex-direction: column; text-align: left; }
.s-ticker { font-weight: 700; font-size: 0.875rem; color: var(--text-primary); }
.s-name { font-size: 0.75rem; color: var(--text-muted); }

.s-score { font-weight: 800; font-size: 0.875rem; }
.s-score.buy { color: var(--accent-buy); }
.s-score.sell { color: var(--accent-sell); }
.s-score.hold { color: var(--accent-hold); }
.search-box:focus-within { border-color: var(--text-muted); box-shadow: 0 0 0 2px rgba(255,255,255,0.05); }
.search-icon { color: var(--text-muted); margin-right: 0.75rem; display: flex; }
.search-box input {
    background: transparent; border: none; outline: none; color: var(--text-primary);
    font-size: 1rem; width: 100%; font-family: var(--font-sans); min-height: 38px;
}
.search-box input::placeholder { color: var(--text-muted); }

.hero-quick-links {
    display: flex;
    justify-content: center;
    gap: 0.9rem;
    flex-wrap: wrap;
    margin-top: 0.8rem;
}

.hero-quick-links a {
    color: var(--text-secondary);
    text-decoration: none;
    border: 0;
    background: transparent;
    padding: 0;
    border-radius: 0;
    font-size: 0.86rem;
    font-weight: 600;
}

.hero-quick-links a:hover {
    color: var(--text-primary);
    text-decoration: underline;
}

.teaser-shell {
    position: relative;
    margin-bottom: 1rem;
}

.teaser-shell.is-locked::after {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: 14px;
    background: linear-gradient(180deg, rgba(2, 6, 23, 0.18), rgba(2, 6, 23, 0.65));
    pointer-events: none;
    z-index: 2;
}

.teaser-list {
    display: block;
    border: 1px solid var(--border-subtle);
    border-radius: 12px;
    overflow: hidden;
    background: rgba(6, 14, 28, 0.72);
    margin-bottom: 0;
}

.teaser-item {
    display: flex;
    flex-direction: column;
    text-decoration: none;
    color: var(--text-primary);
    border: 0;
    border-bottom: 1px solid var(--border-subtle);
    background: transparent;
    border-radius: 0;
    padding: 0.78rem 0.92rem;
    transition: border-color 0.2s, background-color 0.2s;
}

.teaser-item:last-child {
    border-bottom: 0;
}

.teaser-item:hover {
    background: rgba(255, 255, 255, 0.035);
}

.teaser-item.teaser-item-locked {
    filter: blur(3px);
    opacity: 0.58;
    user-select: none;
    pointer-events: none;
}

.teaser-main {
    display: flex;
    justify-content: space-between;
    gap: 0.8rem;
    align-items: baseline;
}

.teaser-ticker {
    font-size: 0.96rem;
    font-weight: 800;
    letter-spacing: 0.01em;
}

.teaser-rank {
    font-size: 0.75rem;
    color: var(--text-secondary);
    font-weight: 700;
}

.teaser-sub {
    margin-top: 0.45rem;
    display: flex;
    align-items: center;
    gap: 0.45rem;
    color: var(--text-secondary);
}

.teaser-name {
    font-size: 0.9rem;
}

.teaser-meta {
    margin-top: 0.65rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.7rem;
}

.teaser-score {
    font-size: 0.78rem;
    color: var(--text-secondary);
    font-weight: 700;
}

.teaser-lock-overlay {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    z-index: 3;
    width: min(540px, calc(100% - 1.2rem));
    text-align: center;
    background: rgba(2, 6, 23, 0.84);
    border: 1px solid var(--border-active);
    border-radius: 12px;
    padding: 1rem 1rem 1.1rem;
    backdrop-filter: blur(4px);
}

.teaser-lock-overlay h3 {
    font-size: 1.05rem;
    margin: 0 0 0.35rem;
}

.teaser-lock-overlay p {
    margin: 0 0 0.85rem;
    font-size: 0.88rem;
    color: var(--text-secondary);
}

/* Grid */
.stock-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1rem;
    padding-bottom: 4rem;
}

@media (max-width: 480px) {
    .stock-grid {
        grid-template-columns: 1fr;
    }
}

/* Card */
.stock-card {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: 12px;
    padding: 1.5rem;
    display: flex; flex-direction: column; justify-content: space-between;
    transition: transform 0.2s, border-color 0.2s, background-color 0.2s;
    min-height: 180px;
}
.stock-card:hover { transform: translateY(-2px); border-color: var(--border-active); background-color: var(--bg-card-hover); }
.stock-card-link {
    color: inherit;
    text-decoration: none;
}

.card-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 1.5rem; }
.ticker { font-size: 0.75rem; font-weight: 700; color: var(--text-muted); letter-spacing: 0.05em; background: rgba(255,255,255,0.03); padding: 4px 8px; border-radius: 4px; }
.rank { font-size: 0.75rem; font-weight: 600; color: var(--text-secondary); }

.card-body { margin-bottom: 1.5rem; text-align: center; }
.name { font-size: 1.125rem; font-weight: 600; margin-bottom: 0.5rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.signal-badge {
    display: inline-block; font-size: 0.875rem; font-weight: 800; padding: 0.25rem 1rem; border-radius: 99px; letter-spacing: 0.05em;
}
.signal-badge.buy { color: var(--accent-buy); background: var(--accent-buy-dim); border: 1px solid rgba(16, 185, 129, 0.2); }
.signal-badge.sell { color: var(--accent-sell); background: var(--accent-sell-dim); border: 1px solid rgba(239, 68, 68, 0.2); }
.signal-badge.hold { color: var(--accent-hold); background: rgba(245, 158, 11, 0.1); border: 1px solid rgba(245, 158, 11, 0.2); }

.card-footer { display: flex; justify-content: space-between; border-top: 1px solid var(--border-subtle); padding-top: 1rem; }
.metric { display: flex; flex-direction: column; }
.metric .label { font-size: 0.65rem; color: var(--text-muted); font-weight: 600; letter-spacing: 0.05em; margin-bottom: 2px; }
.metric .value { font-size: 1rem; font-weight: 600; color: var(--text-primary); font-feature-settings: "tnum"; }

/* Blur Overlay */
.blur-overlay {
    grid-column: 1 / -1;
    background: linear-gradient(to bottom, transparent, var(--bg-root));
    padding: 4rem 0;
    text-align: center;
    border: 1px dashed var(--border-active);
    border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
    background: rgba(255,255,255,0.02);
}
.cta-box { max-width: 400px; }
.cta-box h3 { font-size: 1.5rem; margin-bottom: 0.5rem; }
.cta-box p { color: var(--text-secondary); margin-bottom: 1.5rem; }
.btn-primary {
    background: linear-gradient(135deg, #e7f2ff 0%, #c6dcfa 100%);
    border: 1px solid #d8e8ff;
    color: #06162d;
    text-decoration: none;
    padding: 0.75rem 2rem; border-radius: 8px; font-weight: 700; display: inline-block;
    transition: opacity 0.2s;
}
.btn-primary:hover { opacity: 0.96; }

@media (max-width: 768px) {
    .hero h1 { font-size: 2.5rem; }
    .stock-grid { grid-template-columns: 1fr; }
}

/* Market Directory Table */
.directory-header { padding: 4rem 0 2rem; }
.directory-meta {
    margin: 0.28rem 0 0.7rem;
    font-size: 0.83rem;
    color: var(--text-muted);
}
.table-container {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: 8px;
    overflow-x: auto;
    margin-bottom: 4rem;
}
.market-table { width: 100%; border-collapse: collapse; font-size: 0.875rem; }
.market-table th {
    text-align: left; padding: 1rem; border-bottom: 1px solid var(--border-active);
    color: var(--text-muted); font-size: 0.7rem; letter-spacing: 0.1em; font-weight: 700;
}
.market-table td { padding: 1rem; border-bottom: 1px solid var(--border-subtle); }
.market-table tr:hover { background: var(--bg-card-hover); }
.sortable-col { cursor: pointer; }
.link-clean { color: inherit; text-decoration: none; }

.market-search {
    width: min(100%, 460px);
    margin: 0 0 1rem;
    padding: 0.7rem 0.9rem;
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: 10px;
    color: var(--text-primary);
    font-size: 0.95rem;
}

.market-search::placeholder {
    color: var(--text-muted);
}

.text-right { text-align: right; }
.font-mono { font-family: 'SF Mono', 'Courier New', monospace; font-feature-settings: "tnum"; }
.small-caps { font-variant: small-caps; letter-spacing: 0.05em; font-weight: 600; color: var(--text-secondary); }

.sector-square {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 2px;
    margin-right: 8px;
    vertical-align: middle;
    background-color: var(--sector-color, rgba(120, 179, 255, 0.45));
}

.badge-mini {
    padding: 2px 8px; border-radius: 999px; font-size: 0.7rem; font-weight: 800; letter-spacing: 0.05em;
}
.badge-mini.buy { color: var(--accent-buy); background: var(--accent-buy-dim); border: 1px solid rgba(16, 185, 129, 0.25); }
.badge-mini.sell { color: var(--accent-sell); background: var(--accent-sell-dim); border: 1px solid rgba(239, 68, 68, 0.25); }
.badge-mini.hold { color: var(--accent-hold); background: rgba(245, 158, 11, 0.1); border: 1px solid rgba(245, 158, 11, 0.25); }

.buy { color: var(--accent-buy); }
.sell { color: var(--accent-sell); }
.hold { color: var(--accent-hold); }

.nav-link {
    text-decoration: none; color: var(--text-secondary); font-size: 0.875rem;
    font-weight: 700; margin-right: 0; transition: color 0.2s;
}
.nav-link:hover, .nav-link.active { color: var(--text-primary); }

.blur-row td {
    filter: none;
    padding: 2rem;
    position: relative;
    background: rgba(2, 6, 23, 0.55);
}
.locked-row td {
    filter: blur(4px);
    user-select: none;
    pointer-events: none;
}
.table-cta {
    position: absolute; top: 0; left: 0; width: 100%; height: 100%;
    display: flex; align-items: center; justify-content: center;
    filter: none; z-index: 10;
}
.table-cta a {
    background: var(--text-primary); color: var(--bg-root); padding: 0.5rem 1.5rem;
    border-radius: 6px; font-weight: 700; text-decoration: none;
}

/* Trust Stats */
.trust-stats {
    display: flex; justify-content: center; gap: 0.75rem; margin-bottom: 1.4rem; flex-wrap: wrap;
}
.t-stat {
    font-size: 0.8rem;
    color: var(--text-secondary);
    font-weight: 500;
    text-align: center;
    border: 1px solid var(--border-subtle);
    background: rgba(255,255,255,0.02);
    border-radius: 10px;
    padding: 0.45rem 0.7rem;
}
.t-stat span { display: block; font-size: 1.05rem; font-weight: 900; color: var(--text-primary); line-height: 1.2; }
.t-stat.t-stat-buy {
    border-color: rgba(16, 185, 129, 0.5);
    background: rgba(16, 185, 129, 0.12);
}
.t-stat.t-stat-buy span { color: var(--accent-buy); }
.t-stat.t-stat-hold {
    border-color: rgba(245, 158, 11, 0.45);
    background: rgba(245, 158, 11, 0.12);
}
.t-stat.t-stat-hold span { color: var(--accent-hold); }
.t-stat.t-stat-sell {
    border-color: rgba(239, 68, 68, 0.5);
    background: rgba(239, 68, 68, 0.12);
}
.t-stat.t-stat-sell span { color: var(--accent-sell); }

.stock-quote-line {
    display: flex;
    align-items: baseline;
    gap: 0.65rem;
    flex-wrap: wrap;
    margin-top: 0.45rem;
}
.quote-price {
    font-size: 2rem;
    font-weight: 900;
    line-height: 1.1;
    color: var(--text-primary);
}
.quote-change {
    font-size: 1rem;
    font-weight: 800;
    line-height: 1.2;
}
.quote-meta {
    font-size: 0.78rem;
    color: var(--text-muted);
}

.stock-insights-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
    margin: 1rem 0 1.5rem;
}
.related-sector-section {
    margin-top: 2rem;
    padding-top: 1.4rem;
    border-top: 1px solid var(--border-subtle);
}
.stock-insight-card {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: 12px;
    padding: 1rem;
}
.stock-insight-card h2 {
    font-size: 0.95rem;
    margin-bottom: 0.75rem;
    color: var(--text-primary);
}
.insight-meta {
    margin: 0.2rem 0 0.8rem;
    color: var(--text-muted);
    font-size: 0.75rem;
}
.insight-kv {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem;
    padding: 0.45rem 0;
    border-top: 1px solid var(--border-subtle);
    font-size: 0.82rem;
}
.insight-kv span { color: var(--text-secondary); }
.insight-kv strong { color: var(--text-primary); font-weight: 700; }

.score-matrix {
    display: grid;
    grid-template-columns: 1.2fr repeat(3, 1fr);
    gap: 0.5rem;
}
.score-head {
    color: var(--text-muted);
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 700;
}
.score-label {
    align-self: center;
    color: var(--text-secondary);
    font-weight: 700;
    font-size: 0.82rem;
}
.score-cell {
    border: 1px solid var(--border-subtle);
    background: rgba(255,255,255,0.015);
    border-radius: 8px;
    text-align: center;
    font-weight: 800;
    padding: 0.45rem 0.35rem;
    font-size: 0.82rem;
}

.dividend-pill {
    border: 1px solid var(--border-active);
    border-radius: 999px;
    padding: 0.3rem 0.7rem;
    display: inline-block;
    font-size: 0.75rem;
    font-weight: 700;
    margin-bottom: 0.7rem;
}
.dividend-toggle-wrap { margin-top: 0.75rem; }
.related-stock-grid { padding-bottom: 1rem; }
.dividend-metrics {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.5rem;
    margin-bottom: 0.4rem;
}
.dividend-summary-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.5rem;
    margin-bottom: 0.45rem;
}
.metric-box {
    border: 1px solid var(--border-subtle);
    border-radius: 8px;
    background: rgba(255,255,255,0.015);
    padding: 0.5rem 0.45rem;
    text-align: center;
}
.metric-box span {
    display: block;
    color: var(--text-muted);
    font-size: 0.7rem;
    margin-bottom: 0.2rem;
}
.metric-box strong {
    font-size: 0.95rem;
    font-weight: 800;
}
.btn-mini {
    padding: 0.35rem 0.75rem;
    font-size: 0.76rem;
    min-height: auto;
}
.dividend-history-panel {
    display: none;
    margin-top: 0.55rem;
    border: 1px solid var(--border-subtle);
    border-radius: 8px;
    overflow: hidden;
    background: rgba(255,255,255,0.015);
}
.dividend-history-panel.open { display: block; }
.dividend-history-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.76rem;
}
.dividend-history-table th,
.dividend-history-table td {
    padding: 0.45rem 0.55rem;
    border-bottom: 1px solid var(--border-subtle);
}
.dividend-history-table tr:last-child td { border-bottom: 0; }
.dividend-history-table th {
    color: var(--text-muted);
    text-align: left;
    font-size: 0.68rem;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}
.projection-grid {
    display: grid;
    gap: 0.55rem;
}
.projection-row {
    border: 1px solid var(--border-subtle);
    border-radius: 8px;
    background: rgba(255,255,255,0.015);
    padding: 0.55rem 0.65rem;
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 0.25rem 0.7rem;
    align-items: center;
}
.projection-label {
    color: var(--text-secondary);
    font-size: 0.78rem;
    font-weight: 700;
}
.projection-price {
    text-align: right;
    font-size: 0.9rem;
    font-weight: 800;
    color: var(--text-primary);
}
.projection-meta {
    grid-column: 1 / 2;
    color: var(--text-muted);
    font-size: 0.72rem;
}
.projection-range {
    grid-column: 2 / 3;
    text-align: right;
    color: var(--text-secondary);
    font-size: 0.72rem;
}

.utility-points {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.75rem;
    margin: 1.2rem auto 0;
    max-width: 920px;
}

.utility-point {
    background: linear-gradient(180deg, rgba(17, 29, 51, 0.78), rgba(12, 20, 37, 0.82));
    border: 1px solid var(--border-active);
    border-radius: 12px;
    padding: 0.95rem;
    text-align: left;
}

.utility-point h3 {
    font-size: 0.92rem;
    margin-bottom: 0.25rem;
}

.utility-point p {
    margin: 0;
    color: var(--text-secondary);
    font-size: 0.82rem;
}

.legal-page {
    padding: 2.2rem 0 3rem;
}

.legal-card {
    max-width: 900px;
    margin: 0 auto;
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: 14px;
    padding: 1.25rem 1.3rem;
}

.legal-card h1 {
    font-size: clamp(1.5rem, 4vw, 2rem);
    margin-bottom: 0.2rem;
}

.legal-meta {
    margin: 0 0 1rem;
    color: var(--text-muted);
    font-size: 0.83rem;
}

.legal-card section {
    margin-top: 1rem;
    padding-top: 0.9rem;
    border-top: 1px solid var(--border-subtle);
}

.legal-card h2 {
    font-size: 1rem;
    margin-bottom: 0.35rem;
}

.legal-card p {
    margin: 0;
    color: var(--text-secondary);
    line-height: 1.6;
}

/* Footer */
.main-footer {
    background: #020617;
    border-top: 1px solid var(--border-subtle);
    padding: 5rem 0 2rem;
    margin-top: 4rem;
    color: var(--text-secondary);
}
.footer-grid {
    display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 4rem; margin-bottom: 4rem;
}
.f-col h4 { color: var(--text-primary); font-size: 1rem; margin-bottom: 1.5rem; }
.f-col p { font-size: 0.875rem; line-height: 1.6; }
.footer-links { margin-top: 0.8rem; }
.footer-links a {
    display: inline-block;
    color: var(--text-primary);
    text-decoration: none;
    border-bottom: 1px solid var(--border-active);
    font-size: 0.85rem;
    margin: 0 0 0.45rem;
}
.footer-links a:hover { border-color: var(--text-primary); }
.footer-links a:last-child { margin-bottom: 0; }

.contact-info { margin-top: 1rem; font-weight: 600; }
.contact-info a { color: var(--text-primary); text-decoration: none; border-bottom: 1px solid var(--border-active); }
.contact-info a:hover { border-color: var(--text-primary); }

.disclaimer-box {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-subtle);
    padding: 1.5rem;
    border-radius: 8px;
    font-size: 0.75rem;
    line-height: 1.6;
    color: var(--text-muted);
    margin-bottom: 3rem;
}
.disclaimer-box strong { color: var(--text-secondary); }

.footer-bottom {
    border-top: 1px solid var(--border-subtle);
    padding-top: 2rem;
    text-align: center;
    font-size: 0.75rem;
    color: var(--text-muted);
}

.small-print { font-size: 0.75rem; color: var(--text-muted); margin-top: 1rem; }

/* Global Modals */
.modal { 
    display: none; 
    position: fixed; 
    top: 0; 
    left: 0; 
    width: 100%; 
    height: 100%; 
    background: rgba(0,0,0,0.85); 
    z-index: 9999; 
    align-items: center; 
    justify-content: center; 
    backdrop-filter: blur(8px);
}
.modal-content { 
    background: var(--bg-card); 
    padding: 2.5rem; 
    border-radius: 20px; 
    width: 100%;
    max-width: 500px;
    border: 1px solid var(--border-active); 
    max-height: 90vh; 
    overflow-y: auto;
    position: relative;
}

/* Hero Actions */
.hero-actions {
    margin-top: 1rem;
    display: flex;
    justify-content: center;
    gap: 0.65rem;
    flex-wrap: wrap;
}

.hero-actions .btn-primary,
.hero-actions .btn-secondary {
    min-width: 150px;
    text-align: center;
}
.btn-secondary {
    display: inline-block;
    background: #13223d;
    border: 1px solid var(--border-active);
    color: var(--text-primary);
    padding: 0.75rem 2rem;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 600;
    transition: background 0.2s;
}
.btn-secondary:hover { background: var(--bg-card-hover); }

/* Feature Promo */
.feature-promo {
    background: linear-gradient(110deg, rgba(13, 25, 46, 0.78), rgba(8, 14, 30, 0.78));
    border: 1px solid var(--border-active);
    border-radius: 24px;
    padding: 1.6rem;
    margin: 2rem 0 4rem;
}
.promo-content {
    display: flex; justify-content: space-between; align-items: center; gap: 2rem;
}
.promo-text h2 { font-size: 1.5rem; margin-bottom: 0.5rem; }
.promo-text p { color: var(--text-secondary); margin: 0; }
.btn-outline {
    border: 1px solid var(--text-primary);
    color: var(--text-primary);
    padding: 0.75rem 2.5rem;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 700;
    white-space: nowrap;
    transition: background 0.2s, color 0.2s;
}
.btn-outline:hover { background: var(--text-primary); color: var(--bg-root); }

.home-workflow {
    margin: 0 0 1.35rem;
}

.home-workflow h2 {
    font-size: clamp(1.05rem, 2.5vw, 1.3rem);
    margin: 0 0 0.85rem;
}

.home-workflow-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.75rem;
}

.home-workflow-item {
    border: 1px solid var(--border-active);
    border-radius: 12px;
    background: linear-gradient(180deg, rgba(17, 30, 55, 0.82), rgba(12, 20, 37, 0.58));
    padding: 0.9rem;
}

.home-workflow-item h3 {
    font-size: 0.92rem;
    margin: 0 0 0.3rem;
}

.home-workflow-item p {
    margin: 0;
    color: var(--text-secondary);
    font-size: 0.83rem;
    line-height: 1.5;
}

@media (max-width: 768px) {
    .promo-content { flex-direction: column; text-align: center; }
    .utility-points { grid-template-columns: 1fr; margin-top: 1rem; }
    .home-workflow-grid { grid-template-columns: 1fr; }
    .footer-grid { grid-template-columns: 1fr; gap: 2rem; }
    .legal-page { padding: 1.35rem 0 2rem; }
    .legal-card { padding: 1rem; border-radius: 12px; }
    .legal-card h2 { font-size: 0.96rem; }
    .quote-price { font-size: 1.7rem; }
    .quote-change { font-size: 0.95rem; }
    .quote-meta { width: 100%; }
    .stock-insights-grid { grid-template-columns: 1fr; }
    .dividend-summary-grid { grid-template-columns: 1fr 1fr; }
    .dividend-metrics { grid-template-columns: 1fr 1fr 1fr; }
    .hero-actions {
        width: 100%;
    }
    .hero-actions .btn-primary,
    .hero-actions .btn-secondary {
        width: 100%;
    }
}

@media (max-width: 900px) {
    .container { padding: 0 1rem; }
    .directory-header { padding: 1.8rem 0 1rem; }
    .directory-header .subtitle {
        margin-bottom: 0.8rem;
        font-size: 0.95rem;
        line-height: 1.5;
    }
    .market-search {
        width: 100%;
        margin-bottom: 0.75rem;
        min-height: 42px;
        font-size: 0.95rem;
    }
    .table-container {
        background: transparent;
        border: none;
        border-radius: 0;
        overflow: visible;
    }

    .market-table, .market-table tbody, .market-table tr {
        display: block;
        width: 100%;
    }

    .market-table thead {
        display: none;
    }

    .market-table tr {
        margin-bottom: 0.8rem;
        border: 1px solid var(--border-subtle);
        border-radius: 14px;
        background: var(--bg-card);
        overflow: hidden;
    }

    .market-table td {
        display: grid;
        grid-template-columns: minmax(80px, 96px) minmax(0, 1fr);
        align-items: start;
        gap: 0.25rem 0.75rem;
        width: auto;
        box-sizing: border-box;
        padding: 0.72rem 0.88rem;
        border-bottom: 1px solid var(--border-subtle);
        text-align: left !important;
        font-size: 0.92rem;
        line-height: 1.35;
    }

    .market-table td .cell-value {
        min-width: 0;
        display: inline-flex;
        align-items: center;
        gap: 0.45rem;
        justify-content: flex-start;
    }

    .market-table td:last-child {
        border-bottom: 0;
    }

    .market-table td::before {
        content: attr(data-label);
        color: var(--text-muted);
        font-size: 0.68rem;
        letter-spacing: 0.05em;
        font-weight: 700;
        text-transform: uppercase;
        text-align: left;
        padding-top: 0.12rem;
    }

    .market-table td.text-right {
        text-align: right !important;
        font-variant-numeric: tabular-nums;
        font-size: 0.95rem;
        font-weight: 700;
    }

    .market-table td.text-right .cell-value {
        width: 100%;
        justify-content: flex-end;
    }

    .market-table td.ticker-cell {
        background: rgba(255,255,255,0.02);
    }

    .market-table td.ticker-cell strong {
        font-size: 1rem;
        letter-spacing: 0.01em;
        color: var(--text-primary);
    }

    .market-table td.name-cell {
        color: var(--text-secondary);
    }

    .market-table td.name-cell .name-value {
        align-items: flex-start;
    }

    .market-table td.name-cell .company-name {
        display: block;
        line-height: 1.35;
        word-break: break-word;
    }

    .market-table td.name-cell .sector-square {
        margin-top: 0.28rem;
        flex: 0 0 auto;
    }

    .market-table td[data-label="Signal"] .badge-mini {
        font-size: 0.74rem;
        letter-spacing: 0.04em;
        padding: 0.2rem 0.55rem;
    }

    .market-table td a {
        color: var(--text-primary);
        text-decoration: none;
    }

    .market-table td a:focus-visible {
        outline: 2px solid var(--accent-brand);
        outline-offset: 2px;
        border-radius: 4px;
    }

    .blur-row td {
        display: block;
        filter: none;
        padding: 1.2rem;
        text-align: center !important;
    }

    .blur-row td::before {
        display: none;
    }

    .table-cta {
        position: static;
        width: auto;
        height: auto;
    }
}

@media (max-width: 768px) {
    .home-page {
        padding-left: 1rem;
        padding-right: 1rem;
    }

    .home-page .hero {
        text-align: left;
        padding: 2.1rem 1rem 1.45rem;
        max-width: none;
        border-radius: 16px;
    }

    .home-page .hero h1 {
        font-size: clamp(1.95rem, 8.6vw, 2.45rem);
        line-height: 1.12;
        margin-bottom: 0.7rem;
    }

    .home-page .home-signature {
        justify-content: flex-start;
        margin-bottom: 0.65rem;
    }

    .home-page .home-pill {
        font-size: 0.68rem;
        padding: 0.3rem 0.62rem;
    }

    .home-page .subtitle {
        font-size: 1rem;
        line-height: 1.55;
        margin-bottom: 0.65rem;
        max-width: none;
    }

    .home-page .home-signal-note {
        font-size: 0.88rem;
        margin: 0 0 1rem;
        max-width: none;
    }

    .home-page .trust-stats {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 0.6rem;
        margin-bottom: 1.1rem;
        justify-content: stretch;
    }

    .home-page .trust-stats .t-stat:last-child {
        grid-column: 1 / -1;
    }

    .home-page .t-stat {
        font-size: 0.82rem;
        line-height: 1.3;
        padding: 0.55rem 0.65rem;
        border-radius: 12px;
    }

    .home-page .t-stat span {
        font-size: 1.02rem;
    }

    .home-page .search-box {
        margin: 0;
        padding: 0.65rem 0.8rem;
        border-radius: 12px;
    }

    .home-page .search-icon {
        margin-right: 0.65rem;
    }

    .home-page .search-box input {
        min-height: 40px;
        font-size: 1rem;
    }

    .home-page .suggestion-item {
        padding: 0.85rem 0.95rem;
    }

    .home-page .s-ticker {
        font-size: 0.9rem;
    }

    .home-page .s-name {
        font-size: 0.8rem;
    }

    .home-page .hero-quick-links {
        justify-content: flex-start;
        margin-top: 0.95rem;
        gap: 0.5rem;
    }

    .home-page .hero-quick-links a {
        display: inline;
        font-size: 0.82rem;
        padding: 0;
    }

    .home-page .hero-actions {
        margin-top: 1.05rem;
        gap: 0.55rem;
    }

    .home-page .hero-actions .btn-primary,
    .home-page .hero-actions .btn-secondary {
        min-height: 46px;
        padding: 0.8rem 1rem;
        font-size: 0.95rem;
        font-weight: 700;
    }

    .home-page .utility-points {
        margin-top: 1.15rem;
        gap: 0.7rem;
    }

    .home-page .utility-point {
        padding: 1rem;
        border-radius: 12px;
    }

    .home-page .utility-point h3 {
        font-size: 0.96rem;
        line-height: 1.35;
        margin-bottom: 0.35rem;
    }

    .home-page .utility-point p {
        font-size: 0.9rem;
        line-height: 1.5;
    }

    .home-page .feature-promo {
        margin: 1.5rem 0 2.2rem;
        padding: 1.15rem;
        border-radius: 18px;
    }

    .home-page .home-workflow {
        margin-bottom: 1rem;
    }

    .home-page .home-workflow h2 {
        font-size: 1.08rem;
        margin-bottom: 0.65rem;
    }

    .home-page .home-workflow-grid {
        gap: 0.6rem;
    }

    .home-page .home-workflow-item {
        padding: 0.85rem;
    }

    .home-page .home-workflow-item h3 {
        font-size: 0.9rem;
    }

    .home-page .home-workflow-item p {
        font-size: 0.87rem;
    }

    .home-page .promo-text h2 {
        font-size: 1.2rem;
        line-height: 1.3;
        margin-bottom: 0.4rem;
    }

    .home-page .promo-text p {
        font-size: 0.94rem;
        line-height: 1.5;
    }

    .home-page .feature-promo .btn-outline {
        width: 100%;
        max-width: 320px;
        min-height: 46px;
        text-align: center;
        padding: 0.8rem 1rem;
    }

    .home-page .teaser-list { margin-bottom: 0.9rem; }

    .home-page .teaser-item { padding: 0.82rem 0.84rem; }

    .home-page .teaser-ticker {
        font-size: 0.92rem;
    }

    .home-page .teaser-rank {
        font-size: 0.72rem;
    }

    .home-page .teaser-name {
        font-size: 0.88rem;
        line-height: 1.35;
    }

    .home-page .teaser-meta {
        margin-top: 0.55rem;
    }

    .home-page .teaser-score {
        font-size: 0.75rem;
    }

    .home-page .teaser-lock-overlay {
        width: calc(100% - 0.8rem);
        padding: 0.9rem;
    }

    .home-page .teaser-lock-overlay h3 {
        font-size: 0.98rem;
    }

    .home-page .teaser-lock-overlay p {
        font-size: 0.82rem;
        margin-bottom: 0.7rem;
    }

    .home-page .teaser-lock-overlay .btn-primary {
        min-height: 44px;
        padding: 0.75rem 1rem;
        width: 100%;
        max-width: 260px;
    }

    .home-page .stock-grid {
        gap: 0.9rem;
        padding-bottom: 2.2rem;
    }

    .home-page .stock-card {
        padding: 1.05rem;
        min-height: auto;
        border-radius: 12px;
    }

    .home-page .card-header {
        margin-bottom: 0.95rem;
        align-items: center;
    }

    .home-page .ticker,
    .home-page .rank {
        font-size: 0.78rem;
    }

    .home-page .card-body {
        margin-bottom: 1rem;
        text-align: left;
    }

    .home-page .name {
        font-size: 1.02rem;
        white-space: normal;
        line-height: 1.35;
        margin-bottom: 0.5rem;
    }

    .home-page .signal-badge {
        font-size: 0.82rem;
        padding: 0.32rem 0.85rem;
    }

    .home-page .card-footer {
        padding-top: 0.8rem;
    }

    .home-page .metric .label {
        font-size: 0.72rem;
    }

    .home-page .metric .value {
        font-size: 0.98rem;
    }

    .home-page .blur-overlay {
        padding: 1.7rem 0.75rem;
        border-radius: 12px;
    }

    .home-page .cta-box h3 {
        font-size: 1.2rem;
    }

    .home-page .cta-box p {
        font-size: 0.9rem;
        line-height: 1.5;
        margin-bottom: 1rem;
    }

    .home-page .cta-box .btn-primary {
        width: 100%;
        max-width: 280px;
        min-height: 46px;
        padding: 0.8rem 1rem;
    }
}

/* Flatpickr Custom */
.flatpickr-calendar {
    background: var(--bg-card) !important;
    border: 1px solid var(--border-active) !important;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.5) !important;
    color: var(--text-primary) !important;
}
.flatpickr-day { color: var(--text-primary) !important; }
.flatpickr-day.selected, .flatpickr-day.startRange, .flatpickr-day.endRange {
    background: var(--text-primary) !important;
    color: var(--bg-root) !important;
    border-color: var(--text-primary) !important;
}
.flatpickr-day:hover {
    background: var(--bg-card-hover) !important;
}
.flatpickr-current-month, .flatpickr-weekday {
    color: var(--text-primary) !important;
}
.flatpickr-months .flatpickr-prev-month, .flatpickr-months .flatpickr-next-month {
    fill: var(--text-secondary) !important;
}
.flatpickr-day.flatpickr-disabled, .flatpickr-day.flatpickr-disabled:hover {
    color: var(--text-muted) !important;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}

.mobile-cta-bar,
.mobile-dock {
    display: none;
}

@media (max-width: 900px) {
    body.has-mobile-dock,
    body.has-mobile-cta {
        padding-bottom: calc(76px + env(safe-area-inset-bottom));
    }

    .mobile-dock {
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 930;
        display: grid;
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 0.5rem;
        padding: 0.6rem 0.72rem calc(0.62rem + env(safe-area-inset-bottom));
        background: linear-gradient(180deg, rgba(4, 10, 21, 0.96), rgba(3, 8, 18, 0.98));
        border-top: 1px solid var(--border-subtle);
        backdrop-filter: blur(10px);
    }

    .mobile-dock.is-authenticated {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .mobile-dock.is-guest {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .mobile-dock-link {
        min-height: 48px;
        border-radius: 10px;
        display: inline-flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 0.16rem;
        text-decoration: none;
        font-size: 0.69rem;
        font-weight: 700;
        letter-spacing: 0.02em;
        border: 1px solid var(--border-subtle);
        color: var(--text-primary);
        background: rgba(255, 255, 255, 0.02);
        padding: 0.24rem 0.2rem;
        box-sizing: border-box;
    }

    .mobile-dock-icon {
        width: 1.02rem;
        height: 1.02rem;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        color: var(--text-secondary);
        flex: 0 0 auto;
    }

    .mobile-dock-icon svg {
        width: 100%;
        height: 100%;
        stroke: currentColor;
        fill: none;
        stroke-width: 2;
        stroke-linecap: round;
        stroke-linejoin: round;
    }

    .mobile-dock-text {
        line-height: 1.1;
        text-align: center;
        white-space: nowrap;
        max-width: 100%;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .mobile-dock-link.active {
        border-color: var(--border-active);
        background: rgba(57, 194, 255, 0.12);
    }

    .mobile-dock-link.active .mobile-dock-icon {
        color: #e0f2ff;
    }

    .mobile-dock-link.is-auth {
        border-color: rgba(147, 197, 253, 0.55);
        background: rgba(37, 99, 235, 0.24);
        color: #eff8ff;
    }

    .mobile-dock-link.is-logout {
        border-color: rgba(248, 113, 113, 0.46);
        background: rgba(127, 29, 29, 0.2);
        color: #fecaca;
    }

    .mobile-cta-bar {
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 930;
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 0.6rem;
        padding: 0.65rem 0.75rem calc(0.65rem + env(safe-area-inset-bottom));
        background: rgba(2, 6, 23, 0.95);
        border-top: 1px solid var(--border-subtle);
        backdrop-filter: blur(8px);
    }

    .mobile-cta-primary,
    .mobile-cta-secondary {
        min-height: 44px;
        border-radius: 10px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        text-decoration: none;
        font-size: 0.9rem;
        font-weight: 700;
    }

    .mobile-cta-primary {
        background: var(--text-primary);
        color: var(--bg-root);
    }

    .mobile-cta-secondary {
        border: 1px solid var(--border-active);
        color: var(--text-primary);
        background: rgba(255, 255, 255, 0.02);
    }
}

/* Mobile readability pass: improve contrast and touch ergonomics */
@media (max-width: 900px) {
    :root {
        --text-secondary: #cbd5e1;
        --text-muted: #9fb1c9;
        --border-subtle: #31435f;
        --border-active: #4a5f81;
    }

    body.index-page-bg {
        background-image:
            linear-gradient(180deg, rgba(2, 6, 23, 0.72) 0%, rgba(2, 6, 23, 0.84) 48%, rgba(2, 6, 23, 0.94) 100%),
            radial-gradient(circle at 50% -18%, rgba(30, 41, 59, 0.64) 0%, rgba(2, 6, 23, 0.96) 78%),
            url('/assets/img/background.png');
    }

    .main-nav {
        background: linear-gradient(180deg, #0b1222 0%, #111c33 100%);
    }

    .nav-mobile-close {
        color: var(--text-primary);
        border-color: rgba(127, 148, 177, 0.35);
        background: rgba(255, 255, 255, 0.02);
    }

    .nav-link {
        color: var(--text-primary);
        font-weight: 700;
        min-height: 46px;
        padding: 0.85rem 0.8rem;
    }

    .nav-btn {
        min-height: 46px;
        font-size: 0.92rem;
    }

    .lang-switcher a,
    .hero-quick-links a {
        color: var(--text-primary);
    }

    .subtitle,
    .utility-point p,
    .promo-text p,
    .teaser-rank,
    .teaser-sub,
    .teaser-score,
    .metric .label,
    .s-name,
    .quote-meta,
    .insight-meta,
    .projection-meta,
    .projection-range,
    .legal-meta,
    .legal-card p,
    .f-col p,
    .disclaimer-box,
    .footer-bottom,
    .small-print {
        color: var(--text-secondary);
    }

    .search-box,
    .market-search,
    .header-stock-search input,
    .market-table tr,
    .stock-card,
    .utility-point,
    .feature-promo,
    .teaser-item,
    .table-container {
        border-color: var(--border-active);
    }

    .search-box input,
    .header-stock-search input,
    .market-search {
        font-size: 16px;
        min-height: 44px;
    }

    .btn-primary,
    .btn-secondary,
    .btn-outline,
    .mobile-cta-primary,
    .mobile-cta-secondary {
        min-height: 46px;
    }

    .btn-secondary {
        background: #0b1730;
        border-color: var(--border-active);
        color: var(--text-primary);
    }

    .market-table tr {
        background: linear-gradient(180deg, rgba(15, 23, 42, 0.95), rgba(10, 17, 33, 0.95));
        box-shadow: 0 2px 14px rgba(0, 0, 0, 0.22);
    }

    .market-table td {
        font-size: 0.96rem;
        line-height: 1.45;
    }

    .market-table td::before {
        color: var(--text-secondary);
        font-size: 0.72rem;
    }

    .market-table td.name-cell {
        color: var(--text-primary);
    }

    .market-table td .company-name {
        color: var(--text-secondary);
    }
}

/* Small phone tuning (iPhone mini/SE widths and similar) */
@media (max-width: 430px) {
    .container {
        padding: 0 0.78rem;
    }

    .header-inner {
        min-height: 64px;
        padding: 0 0.78rem;
    }

    .logo {
        font-size: 1.06rem;
        gap: 0.35rem;
    }

    .beta-tag {
        font-size: 0.55rem;
        padding: 0.1rem 0.32rem;
    }

    .main-nav {
        width: min(92%, 360px);
        padding: calc(0.56rem + env(safe-area-inset-top)) 0.78rem 0.82rem;
    }

    .home-page .hero {
        padding: 1.55rem 0.8rem 1.05rem;
    }

    .home-page .hero h1 {
        font-size: clamp(1.75rem, 9.5vw, 2.05rem);
        margin-bottom: 0.58rem;
    }

    .home-page .home-signature {
        gap: 0.42rem;
    }

    .home-page .home-pill {
        font-size: 0.64rem;
        padding: 0.26rem 0.52rem;
    }

    .home-page .subtitle {
        font-size: 0.96rem;
        line-height: 1.45;
        margin-bottom: 0.55rem;
    }

    .home-page .home-signal-note {
        font-size: 0.82rem;
        margin: 0 0 0.82rem;
    }

    .home-page .trust-stats {
        grid-template-columns: 1fr;
        gap: 0.48rem;
    }

    .home-page .trust-stats .t-stat:last-child {
        grid-column: auto;
    }

    .home-page .search-box {
        padding: 0.58rem 0.7rem;
    }

    .home-page .search-box input,
    .header-stock-search input,
    .market-search {
        min-height: 42px;
        font-size: 16px;
    }

    .nav-btn,
    .btn-primary,
    .btn-secondary,
    .btn-outline {
        min-height: 44px;
    }

    .home-page .teaser-list { border-radius: 10px; }

    .home-page .teaser-item,
    .home-page .stock-card {
        padding: 0.8rem;
    }

    .home-page .feature-promo {
        padding: 0.95rem;
        margin: 1.1rem 0 1.5rem;
    }

    .home-page .home-workflow-item {
        padding: 0.72rem;
    }

    .home-page .home-workflow-item h3 {
        font-size: 0.86rem;
    }

    .home-page .home-workflow-item p {
        font-size: 0.82rem;
    }

    .directory-header {
        padding: 1.25rem 0 0.85rem;
    }

    .market-table td {
        grid-template-columns: minmax(74px, 90px) minmax(0, 1fr);
        padding: 0.66rem 0.72rem;
        gap: 0.2rem 0.58rem;
        font-size: 0.91rem;
    }

    .market-table td::before {
        font-size: 0.64rem;
        letter-spacing: 0.045em;
    }

    .quote-price {
        font-size: 1.48rem;
    }

    .stock-insight-card {
        padding: 0.8rem;
    }

    .dividend-metrics,
    .dividend-summary-grid {
        gap: 0.4rem;
    }

    .footer-grid {
        gap: 1.35rem;
    }
}

@media (max-width: 380px) {
    .container {
        padding: 0 0.62rem;
    }

    .header-inner {
        padding: 0 0.62rem;
    }

    .home-page .hero h1 {
        font-size: clamp(1.62rem, 9.2vw, 1.9rem);
    }

    .home-page .subtitle {
        font-size: 0.93rem;
    }

    .home-page .hero-quick-links {
        gap: 0.4rem;
    }

    .home-page .hero-quick-links a {
        font-size: 0.78rem;
        padding: 0;
    }

    .market-table td {
        grid-template-columns: minmax(70px, 84px) minmax(0, 1fr);
        font-size: 0.89rem;
    }
}

/* Home V2 (professional landing redesign) */
.home-v2 {
    padding-top: 2.25rem;
    padding-bottom: 2.25rem;
    max-width: 1140px;
    margin: 0 auto;
}

.home-v2-hero {
    position: relative;
    overflow: hidden;
    display: grid;
    grid-template-columns: minmax(0, 1.2fr) minmax(0, 0.8fr);
    gap: 1.5rem;
    background:
        radial-gradient(circle at 86% 10%, rgba(56, 189, 248, 0.14) 0%, rgba(56, 189, 248, 0) 42%),
        linear-gradient(145deg, rgba(10, 19, 35, 0.96) 0%, rgba(5, 11, 22, 0.98) 100%);
    border: 1px solid rgba(71, 100, 139, 0.72);
    border-radius: 24px;
    padding: 2.1rem;
    box-shadow: 0 26px 56px rgba(0, 0, 0, 0.36);
}

.home-v2-hero::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(120deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0));
    pointer-events: none;
}

.home-v2-copy,
.home-v2-preview {
    position: relative;
    z-index: 1;
}

.home-v2-eyebrow {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 0.8rem;
}

.home-v2-chip {
    border: 1px solid rgba(81, 159, 214, 0.6);
    background: rgba(49, 110, 156, 0.22);
    color: #d7ebff;
    border-radius: 999px;
    padding: 0.28rem 0.62rem;
    font-size: 0.7rem;
    letter-spacing: 0.04em;
    font-weight: 700;
    text-transform: uppercase;
}

.home-v2-copy h1 {
    font-size: clamp(2rem, 4.9vw, 3.2rem);
    line-height: 1.08;
    margin: 0 0 0.85rem;
    background: linear-gradient(150deg, #f8fcff 10%, #d3e7fb 50%, #8cc9ef 100%);
    -webkit-background-clip: text;
    color: transparent;
}

.home-v2-subtitle {
    margin: 0;
    color: var(--text-primary);
    font-size: clamp(1rem, 2vw, 1.18rem);
    line-height: 1.55;
    max-width: 62ch;
}

.home-v2-note {
    margin: 0.75rem 0 1.1rem;
    color: var(--text-secondary);
    font-size: 0.95rem;
}

.home-v2-search {
    margin: 0;
    max-width: 100%;
}

.home-v2-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.65rem;
    margin-top: 0.9rem;
}

.home-v2-actions .btn-primary,
.home-v2-actions .btn-secondary {
    min-width: 180px;
    text-align: center;
}

.home-v2-links {
    margin-top: 0.8rem;
    display: flex;
    gap: 0.9rem;
    flex-wrap: wrap;
}

.home-v2-links a {
    color: var(--text-secondary);
    font-size: 0.86rem;
    font-weight: 600;
    text-decoration: none;
}

.home-v2-links a:hover {
    color: var(--text-primary);
    text-decoration: underline;
}

.home-v2-preview {
    background: linear-gradient(180deg, rgba(12, 23, 42, 0.68), rgba(10, 17, 31, 0.78));
    border: 1px solid rgba(42, 59, 87, 0.9);
    border-radius: 18px;
    padding: 1.05rem;
    display: flex;
    flex-direction: column;
    min-height: 100%;
    backdrop-filter: blur(4px);
}

.home-v2-preview-head h2 {
    margin: 0;
    font-size: 1.05rem;
    font-weight: 800;
    background: linear-gradient(120deg, var(--text-primary) 30%, #8eccf5 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    color: transparent;
}

.home-v2-preview-head p {
    margin: 0.3rem 0 0.7rem;
    font-size: 0.82rem;
    color: var(--text-secondary);
}

.home-v2-preview-list {
    border-top: 1px solid var(--border-subtle);
    border-bottom: 1px solid var(--border-subtle);
}

.home-v2-preview-row {
    display: block;
    text-decoration: none;
    color: var(--text-primary);
    padding: 0.72rem 0;
    border-bottom: 1px solid rgba(127, 148, 177, 0.2);
}

.home-v2-preview-row:last-child {
    border-bottom: 0;
}

.home-v2-preview-row:hover {
    background: rgba(255, 255, 255, 0.02);
}

.home-v2-row-main,
.home-v2-row-name,
.home-v2-row-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.6rem;
}

.home-v2-row-main {
    margin-bottom: 0.25rem;
}

.home-v2-row-ticker {
    font-size: 0.92rem;
    font-weight: 800;
}

.home-v2-row-rank {
    font-size: 0.73rem;
    color: var(--text-secondary);
    font-weight: 700;
}

.home-v2-row-name {
    justify-content: flex-start;
    color: var(--text-secondary);
    font-size: 0.84rem;
}

.home-v2-row-score {
    font-size: 0.74rem;
    color: var(--text-secondary);
    font-weight: 700;
}

.home-v2-preview-footer {
    margin-top: 0.8rem;
}

.home-v2-preview-footer .btn-secondary {
    width: 100%;
    text-align: center;
}

.home-v2-proof {
    margin: 1.1rem 0 0.95rem;
    padding: 0.6rem 0;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.8rem;
    border-top: 1px solid rgba(127, 148, 177, 0.22);
    border-bottom: 1px solid rgba(127, 148, 177, 0.22);
}

.home-v2-proof-item {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    padding: 0.15rem 0.15rem 0.15rem 0;
    border-right: 1px dashed rgba(127, 148, 177, 0.26);
}

.home-v2-proof-item:last-child {
    border-right: 0;
}

.home-v2-proof-value {
    font-size: 1.35rem;
    font-weight: 800;
    color: var(--text-primary);
}

.home-v2-proof-label {
    color: var(--text-secondary);
    font-size: 0.82rem;
}

.home-v2-sections {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1.3rem;
    margin-top: 1rem;
}

.home-v2-block {
    border-top: 1px solid rgba(127, 148, 177, 0.22);
    padding-top: 0.75rem;
}

.home-v2-block h2 {
    font-size: 1.2rem;
    margin: 0 0 0.65rem;
}

.home-v2-block-list {
    display: grid;
    gap: 0.65rem;
}

.home-v2-list-item,
.home-v2-step {
    border-top: 0;
    border-bottom: 1px solid rgba(127, 148, 177, 0.2);
    padding: 0.62rem 0;
}

.home-v2-list-item:last-child,
.home-v2-step:last-child {
    border-bottom: 0;
}

.home-v2-list-item h3,
.home-v2-step h3 {
    margin: 0 0 0.25rem;
    font-size: 0.96rem;
}

.home-v2-list-item p,
.home-v2-step p {
    margin: 0;
    color: var(--text-secondary);
    font-size: 0.86rem;
    line-height: 1.5;
}

.home-v2-steps {
    display: grid;
    gap: 0.55rem;
}

.home-v2-step {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 0.65rem;
}

.home-v2-step-index {
    width: 1.7rem;
    height: 1.7rem;
    border-radius: 50%;
    background: rgba(57, 194, 255, 0.17);
    border: 1px solid rgba(57, 194, 255, 0.48);
    color: #dff2ff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.78rem;
    font-weight: 800;
    margin-top: 0.05rem;
}

.home-v2-final {
    margin: 1.35rem 0 0.25rem;
    border: 1px solid rgba(71, 100, 139, 0.75);
    border-radius: 18px;
    padding: 1.35rem;
    background: linear-gradient(125deg, rgba(18, 30, 54, 0.85), rgba(10, 18, 34, 0.74));
    text-align: center;
}

.home-v2-final h2 {
    font-size: clamp(1.2rem, 3vw, 1.65rem);
    margin: 0 0 0.4rem;
}

.home-v2-final p {
    margin: 0 auto;
    color: var(--text-secondary);
    max-width: 64ch;
}

.home-v2-actions-final {
    justify-content: center;
    margin-top: 1rem;
}

@media (max-width: 980px) {
    .home-v2-hero {
        grid-template-columns: 1fr;
        padding: 1.35rem;
        border-radius: 16px;
    }

    .home-v2-copy h1 {
        font-size: clamp(1.85rem, 8.4vw, 2.6rem);
    }

    .home-v2-proof {
        grid-template-columns: 1fr 1fr;
    }

    .home-v2-proof-item:last-child {
        grid-column: 1 / -1;
    }

    .home-v2-sections {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 640px) {
    .home-v2 {
        padding-top: 1.25rem;
        padding-bottom: 1.5rem;
    }

    .home-v2-subtitle,
    .home-v2-note,
    .home-v2-links a,
    .home-v2-list-item p,
    .home-v2-step p,
    .home-v2-final p {
        font-size: 0.92rem;
    }

    .home-v2-actions {
        flex-direction: column;
    }

    .home-v2-actions .btn-primary,
    .home-v2-actions .btn-secondary {
        width: 100%;
        min-width: 0;
        min-height: 46px;
    }

    .home-v2-proof {
        grid-template-columns: 1fr;
        gap: 0.35rem;
    }

    .home-v2-proof-item {
        border-right: 0;
        border-bottom: 1px dashed rgba(127, 148, 177, 0.28);
        padding: 0.38rem 0;
    }

    .home-v2-proof-item:last-child {
        border-bottom: 0;
        grid-column: auto;
    }

    .home-v2-links {
        display: grid;
        grid-template-columns: 1fr;
        gap: 0.36rem;
    }

    .home-v2-links a {
        padding: 0.35rem 0;
    }
}

/* Cross-page professional/mobile polish */
.companies-page .directory-header,
.social-page .directory-header,
.public-portfolio-page .directory-header,
.market-directory-page .directory-header {
    max-width: 980px;
}

.companies-page .market-search {
    max-width: 560px;
}

.companies-page .letter-filter {
    margin-top: 0.9rem;
}

.companies-page .letter-chip {
    min-height: 34px;
}

.social-page .social-guest-cta {
    justify-content: flex-start;
    margin-top: 0.4rem;
}

.social-page .social-table-container {
    border-radius: 12px;
}

.social-page .social-table td[colspan] {
    text-align: center;
    color: var(--text-secondary);
    font-weight: 600;
    padding: 1rem;
}

.social-page .portfolio-risk-label {
    margin-top: 0.15rem;
    font-size: 0.72rem;
    color: var(--text-muted);
}

.social-page .social-actions {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.45rem;
}

.social-page .social-follow-form {
    display: inline-flex;
}

.social-page .action-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    color: var(--text-primary);
    background: var(--bg-card-hover);
    border: 1px solid var(--border-active);
    padding: 0.28rem 0.58rem;
}

.social-page .social-follow-btn {
    border: none;
    cursor: pointer;
}

.social-page .social-follow-btn[disabled] {
    opacity: 0.6;
    cursor: not-allowed;
}

.public-portfolio-page .panel-eyebrow {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.22em;
    color: var(--text-secondary);
}

.public-portfolio-page .value-amount {
    font-size: 2.5rem;
    font-weight: 800;
    color: var(--text-primary);
    margin: 0.5rem 0;
}

.public-portfolio-page .value-currency {
    font-size: 1rem;
    color: var(--text-muted);
}

.public-portfolio-page .chart-wrap {
    max-height: 250px;
    display: flex;
    justify-content: center;
}

.public-portfolio-page .holding-name {
    font-size: 0.7rem;
    color: var(--text-muted);
}

.public-portfolio-page .public-holdings-container {
    margin-bottom: 2.5rem;
}

.stock-detail-page .stock-detail-header {
    padding-bottom: 1rem;
}

.stock-detail-page .stock-trust-stats {
    justify-content: flex-start;
    margin-top: 0.75rem;
    margin-bottom: 0;
}

.stock-detail-page .stock-detail-actions {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
    margin-bottom: 1.6rem;
}

.stock-detail-page .stock-detail-actions .btn-primary,
.stock-detail-page .stock-detail-actions .btn-secondary {
    min-width: 180px;
    text-align: center;
}

.stock-detail-page .related-sector-title {
    font-size: 1rem;
    margin: 0 0 0.8rem;
    color: var(--text-secondary);
}

.profile-page .profile-container {
    max-width: 680px;
}

.profile-page .profile-section {
    box-shadow: 0 12px 28px rgba(2, 6, 23, 0.24);
}

.profile-page .checkbox-group input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: #d2e8ff;
}

.legal-page .legal-card {
    max-width: 920px;
    box-shadow: 0 20px 42px rgba(1, 4, 12, 0.28);
}

.legal-page .legal-meta {
    display: inline-flex;
    align-items: center;
    margin: 0.35rem 0 0.85rem;
    border: 1px solid var(--border-subtle);
    border-radius: 999px;
    padding: 0.2rem 0.62rem;
    font-size: 0.72rem;
}

.legal-page .legal-card > p {
    margin-bottom: 0.75rem;
}

.legal-page .legal-card section {
    padding: 0.2rem 0;
}

.unsubscribe-page {
    padding-top: 1.6rem;
}

.unsubscribe-page .unsubscribe-card {
    max-width: 680px;
}

.unsubscribe-page .unsubscribe-message {
    margin: 0.7rem 0 0;
    border: 1px solid var(--border-subtle);
    border-radius: 12px;
    padding: 0.82rem 0.9rem;
    font-weight: 600;
    line-height: 1.5;
}

.unsubscribe-page .unsubscribe-ok {
    border-color: rgba(16, 185, 129, 0.5);
    background: rgba(16, 185, 129, 0.12);
    color: #9ef4ca;
}

.unsubscribe-page .unsubscribe-err {
    border-color: rgba(239, 68, 68, 0.45);
    background: rgba(239, 68, 68, 0.1);
    color: #fbb2b2;
}

.unsubscribe-page .unsubscribe-actions {
    margin-top: 1rem;
    display: flex;
    gap: 0.65rem;
    flex-wrap: wrap;
}

.unsubscribe-page .unsubscribe-actions .btn-primary,
.unsubscribe-page .unsubscribe-actions .btn-secondary {
    min-width: 170px;
    text-align: center;
}

/* Mobile readability uplift */
@media (max-width: 900px) {
    :root {
        --text-secondary: #c9d6e8;
        --text-muted: #9fb3ce;
    }

    .btn-primary,
    .btn-secondary,
    .btn-outline,
    .nav-btn {
        min-height: 44px;
    }

    .directory-header h1 {
        font-size: clamp(1.45rem, 6.2vw, 1.95rem);
        line-height: 1.2;
    }

    .directory-header .subtitle {
        color: var(--text-secondary);
    }

    .table-container {
        border-radius: 12px;
    }

    .profile-page .profile-section {
        padding: 1rem;
        border-radius: 12px;
    }

    .legal-page .legal-card {
        padding: 1.05rem;
        border-radius: 14px;
    }
}

@media (max-width: 980px) {
    .home-v2-proof {
        margin-top: 0.6rem;
        padding-top: 0.35rem;
    }

    .home-v2-final {
        margin-top: 1rem;
    }
}

@media (max-width: 900px) {
    .home-v2 {
        padding-bottom: 1.5rem;
    }

    .home-v2-hero {
        border-radius: 14px;
        padding: 1rem;
        box-shadow: none;
    }

    .home-v2-copy h1 {
        letter-spacing: -0.02em;
    }

    .home-v2-subtitle {
        line-height: 1.5;
    }

    .home-v2-links {
        gap: 0.68rem;
    }

    .home-v2-links a {
        font-size: 0.84rem;
    }

    .home-v2-proof {
        border-bottom: 1px solid var(--border-subtle);
        padding: 0.15rem 0 0.6rem;
        gap: 0.35rem;
    }

    .home-v2-proof-item {
        border: none;
        border-radius: 0;
        background: transparent;
        padding: 0.3rem 0;
        border-bottom: 1px dashed rgba(127, 148, 177, 0.35);
    }

    .home-v2-proof-item:last-child {
        border-bottom: none;
    }

    .home-v2-proof-value {
        font-size: 1.02rem;
    }

    .home-v2-proof-label {
        font-size: 0.74rem;
    }

    .home-v2-sections {
        margin-top: 0.65rem;
        gap: 0.9rem;
    }

    .home-v2-block h2 {
        font-size: 1.05rem;
        margin-bottom: 0.5rem;
    }

    .home-v2-list-item,
    .home-v2-step {
        border-top: none;
        border-bottom: 1px solid var(--border-subtle);
        padding: 0.45rem 0;
    }

    .home-v2-step:last-child,
    .home-v2-list-item:last-child {
        border-bottom: none;
    }

    .home-v2-final {
        padding: 1rem;
        border-radius: 14px;
    }

    .companies-page .letter-filter {
        flex-wrap: nowrap;
        overflow-x: auto;
        padding-bottom: 0.15rem;
        -webkit-overflow-scrolling: touch;
    }

    .companies-page .letter-chip {
        flex: 0 0 auto;
        min-height: 36px;
        min-width: 36px;
        font-size: 0.78rem;
    }

    .social-page .social-actions-cell {
        text-align: left !important;
    }

    .social-page .social-actions {
        justify-content: flex-start;
        width: 100%;
    }

    .social-page .action-link,
    .social-page .social-follow-btn {
        min-height: 34px;
        padding: 0.24rem 0.56rem;
        font-size: 0.72rem;
        letter-spacing: 0.03em;
    }

    .public-portfolio-page .top-stats {
        gap: 0.9rem;
    }

    .public-portfolio-page .value-amount {
        font-size: 2rem;
    }

    .public-portfolio-page .chart-wrap {
        max-height: 220px;
    }

    .stock-detail-page .stock-trust-stats {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 0.5rem;
    }

    .stock-detail-page .stock-trust-stats .t-stat {
        width: 100%;
    }

    .stock-detail-page .stock-trust-stats .t-stat:last-child {
        grid-column: 1 / -1;
    }

    .stock-detail-page .stock-detail-actions .btn-primary,
    .stock-detail-page .stock-detail-actions .btn-secondary {
        width: 100%;
        min-width: 0;
    }

    .stock-detail-page .projection-row {
        grid-template-columns: 1fr;
    }

    .stock-detail-page .projection-price,
    .stock-detail-page .projection-range {
        text-align: left;
    }

    .stock-detail-page .projection-meta,
    .stock-detail-page .projection-range {
        grid-column: 1 / -1;
    }

    .profile-page .profile-section {
        box-shadow: none;
    }

    .unsubscribe-page .unsubscribe-actions {
        flex-direction: column;
    }

    .unsubscribe-page .unsubscribe-actions .btn-primary,
    .unsubscribe-page .unsubscribe-actions .btn-secondary {
        width: 100%;
        min-width: 0;
    }

    .main-footer {
        margin-top: 2.1rem;
        padding: 2.5rem 0 1.2rem;
    }

    .footer-grid {
        gap: 1.1rem;
        margin-bottom: 1.4rem;
    }

    .disclaimer-box {
        margin-bottom: 1.5rem;
        padding: 1rem;
    }
}

@media (max-width: 430px) {
    .home-v2-proof-item {
        padding: 0.5rem 0.55rem;
    }

    .home-v2-copy h1 {
        font-size: clamp(1.65rem, 8.6vw, 1.98rem);
    }

    .home-v2-subtitle,
    .home-v2-note {
        font-size: 0.9rem;
    }

    .social-page .social-table td {
        padding: 0.66rem 0.72rem;
    }

    .public-portfolio-page .panel-eyebrow {
        letter-spacing: 0.16em;
    }

    .public-portfolio-page .value-amount {
        font-size: 1.75rem;
        margin: 0.35rem 0;
    }

    .stock-detail-page .quote-price {
        font-size: 1.4rem;
    }

    .stock-detail-page .quote-change {
        font-size: 0.9rem;
    }
}

/* Mobile refinement pass: stocks + social + portfolio ergonomics */
@media (max-width: 900px) {
    .stock-detail-page .stock-quote-line {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.35rem;
    }

    .stock-detail-page .stock-insight-card {
        padding: 0.9rem;
        border-radius: 10px;
    }

    .stock-detail-page .insight-kv {
        font-size: 0.86rem;
    }

    .social-page .social-actions {
        display: grid;
        grid-template-columns: 1fr;
        gap: 0.45rem;
        width: 100%;
    }

    .social-page .action-link,
    .social-page .social-follow-btn {
        width: 100%;
        min-height: 40px;
        justify-content: center;
        text-align: center;
        padding: 0.36rem 0.6rem;
        font-size: 0.78rem;
    }

    .companies-page .directory-header .market-search {
        width: 100%;
        min-height: 48px;
        font-size: 0.95rem;
    }

    .companies-page .letter-filter {
        display: grid;
        grid-auto-flow: column;
        grid-auto-columns: max-content;
        overflow-x: auto;
        overscroll-behavior-x: contain;
        padding-bottom: 0.15rem;
        margin-top: 0.8rem;
        scrollbar-width: none;
    }

    .companies-page .letter-filter::-webkit-scrollbar {
        display: none;
    }

    .companies-page .letter-chip {
        min-height: 44px;
        padding: 0.58rem 0.85rem;
        white-space: nowrap;
    }

    .social-page .social-guest-cta {
        margin-top: 0.85rem;
    }

    .social-page .social-guest-cta .btn-primary {
        width: 100%;
        min-width: 0;
        justify-content: center;
    }

    .portfolio-page .charts-grid .chart-container > h3 {
        font-size: 0.72rem !important;
        margin-bottom: 0.7rem !important;
    }

    .portfolio-page .charts-grid .chart-container > div {
        height: 180px !important;
    }

    .portfolio-page .action-stack {
        grid-template-columns: 1fr 1fr !important;
    }

    .portfolio-page .move-form {
        grid-template-columns: 1.25fr 0.75fr !important;
    }

    .portfolio-page .export-grid {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 0.55rem;
    }

    .portfolio-page .export-grid > div {
        grid-column: 1 / -1;
        margin-left: 0 !important;
        border-left: 0 !important;
        padding-left: 0 !important;
        display: grid !important;
        grid-template-columns: 1fr !important;
        gap: 0.45rem !important;
    }

    .portfolio-page .export-grid input[type="date"],
    .portfolio-page .export-grid button {
        width: 100%;
        min-height: 42px;
        box-sizing: border-box;
    }
}

/* Mobile professional polish: landing clarity + navigation */
@media (max-width: 900px) {
    .market-table td .cell-value {
        word-break: break-word;
    }

    .home-v2-hero::after {
        display: none;
    }

    .home-v2-hero {
        border-radius: 16px;
        padding: 1.05rem;
        box-shadow: none;
    }

    .home-v2-copy h1 {
        font-size: clamp(1.78rem, 8.2vw, 2.24rem);
        line-height: 1.12;
        margin-bottom: 0.62rem;
    }

    .home-v2-subtitle {
        font-size: 0.98rem;
        color: #e2ebf8;
    }

    .home-v2-note {
        margin: 0.58rem 0 0.9rem;
        color: #c7d6ea;
        font-size: 0.86rem;
    }

    .home-v2-preview {
        padding: 0.78rem;
        border-radius: 12px;
        border-color: rgba(74, 95, 129, 0.65);
        background: linear-gradient(180deg, rgba(12, 23, 42, 0.88), rgba(9, 16, 30, 0.92));
    }

    .home-v2-preview-head p {
        color: #c5d6ec;
        font-size: 0.8rem;
        margin-bottom: 0.58rem;
    }

    .home-v2-preview-row {
        padding: 0.64rem 0;
    }

    .home-v2-row-name,
    .home-v2-row-rank,
    .home-v2-row-score {
        color: #ccdcf0;
    }

    .home-v2-proof {
        display: none;
    }

    .home-v2-sections {
        margin-top: 0.45rem;
        gap: 0.72rem;
    }

    .home-v2-block {
        padding-top: 0.58rem;
    }

    .home-v2-list-item,
    .home-v2-step {
        padding: 0.5rem 0;
    }

    .home-v2-final {
        margin-top: 0.82rem;
        padding: 0.95rem;
        border-radius: 12px;
    }

    .home-v2-final p {
        color: #d1deef;
        font-size: 0.92rem;
    }
}

@media (max-width: 640px) {
    .home-v2-preview-row:nth-child(n+3) {
        display: none;
    }

    .mobile-dock-link {
        font-size: 0.66rem;
        min-height: 46px;
    }

    .mobile-dock-icon {
        width: 0.98rem;
        height: 0.98rem;
    }
}

@media (max-width: 430px) {
    .mobile-dock {
        gap: 0.4rem;
        padding: 0.52rem 0.56rem calc(0.56rem + env(safe-area-inset-bottom));
    }

    .mobile-dock-link {
        min-height: 44px;
        border-radius: 9px;
        font-size: 0.62rem;
        letter-spacing: 0.01em;
    }

    .mobile-dock-icon {
        width: 0.9rem;
        height: 0.9rem;
    }
}

/* Mobile polish: social/public/profile/legal */
@media (max-width: 900px) {
    .social-page .social-header {
        padding-bottom: 0.7rem;
    }

    .social-page .social-header .subtitle {
        max-width: 60ch;
        font-size: 0.95rem;
        line-height: 1.45;
    }

    .social-page .social-table tr {
        border-radius: 12px;
    }

    .social-page .social-table td:first-child {
        background: rgba(255, 255, 255, 0.02);
    }

    .social-page .social-table td.font-mono {
        font-size: 0.94rem;
    }

    .social-page .action-link,
    .social-page .social-follow-btn {
        border-radius: 10px;
        font-weight: 700;
        letter-spacing: 0.02em;
    }

    .public-portfolio-page .public-portfolio-head {
        padding-bottom: 0.4rem;
    }

    .public-portfolio-page .public-portfolio-head .subtitle {
        font-size: 0.93rem;
        line-height: 1.45;
        color: var(--text-secondary);
    }

    .public-portfolio-page .public-holdings-table tr {
        border-color: var(--border-active);
    }

    .public-portfolio-page .public-holdings-table td:first-child {
        background: rgba(255, 255, 255, 0.02);
    }

    .public-portfolio-page .holding-name {
        font-size: 0.78rem;
        line-height: 1.35;
    }

    .profile-page .profile-container {
        margin: 1.1rem auto 1.85rem;
    }

    .profile-page .profile-section h2 {
        margin-bottom: 0.85rem;
    }

    .profile-page .btn-save,
    .profile-page .btn-delete {
        border-radius: 10px;
    }

    .legal-page .legal-card h1 {
        font-size: clamp(1.3rem, 6vw, 1.65rem);
        line-height: 1.2;
    }

    .legal-page .legal-card h2 {
        font-size: 0.96rem;
    }

    .legal-page .legal-card > p,
    .legal-page .legal-card section p {
        font-size: 0.93rem;
        line-height: 1.55;
    }
}

@media (max-width: 430px) {
    .social-page .social-header .subtitle,
    .public-portfolio-page .public-portfolio-head .subtitle {
        font-size: 0.9rem;
    }

    .legal-page .legal-card > p,
    .legal-page .legal-card section p {
        font-size: 0.9rem;
    }
}

/* Mobile polish: market + companies scanability */
@media (max-width: 900px) {
    .market-directory-page .directory-header,
    .companies-page .directory-header {
        padding-bottom: 0.7rem;
    }

    .market-directory-page .directory-meta,
    .companies-page .directory-meta {
        margin-top: 0.24rem;
        margin-bottom: 0.55rem;
        font-size: 0.8rem;
        color: var(--text-secondary);
    }

    .market-directory-page .table-container,
    .companies-page .table-container {
        margin-bottom: 1.15rem;
    }

    .market-directory-page .market-table tr,
    .companies-page .market-table tr {
        border-color: rgba(74, 95, 129, 0.68);
        background: linear-gradient(180deg, rgba(13, 22, 41, 0.92), rgba(9, 15, 30, 0.9));
        box-shadow: none;
    }

    .market-directory-page .market-table td,
    .companies-page .market-table td {
        grid-template-columns: minmax(72px, 88px) minmax(0, 1fr);
        padding: 0.62rem 0.74rem;
        font-size: 0.91rem;
    }

    .market-directory-page .market-table td::before,
    .companies-page .market-table td::before {
        font-size: 0.66rem;
        color: #c3d3e7;
    }

    .market-directory-page .market-table td.ticker-cell strong,
    .companies-page .market-table td:first-child strong {
        font-size: 0.96rem;
    }

    .market-directory-page .market-table td.name-cell .company-name,
    .companies-page .market-table td:nth-child(2) .cell-value,
    .companies-page .market-table td:nth-child(2) {
        color: var(--text-secondary);
        line-height: 1.35;
    }

    .companies-page .letter-filter {
        margin-top: 0.68rem;
        padding-bottom: 0.24rem;
    }

    .companies-page .letter-chip {
        min-height: 38px;
        min-width: 38px;
        padding: 0 0.68rem;
        border-color: rgba(71, 100, 139, 0.7);
        background: rgba(255, 255, 255, 0.035);
    }
}

@media (max-width: 430px) {
    .market-directory-page .market-table td,
    .companies-page .market-table td {
        grid-template-columns: minmax(68px, 82px) minmax(0, 1fr);
        padding: 0.58rem 0.66rem;
        font-size: 0.88rem;
    }

    .market-directory-page .directory-meta,
    .companies-page .directory-meta {
        font-size: 0.77rem;
    }
}

/* Mobile clarity pass: navigation + landing simplification */
@media (max-width: 900px) {
    .header-inner {
        min-height: 62px;
        padding: 0 0.78rem;
    }

    .logo {
        font-size: 1.02rem;
        letter-spacing: 0.01em;
    }

    .mobile-menu-toggle {
        border: 1px solid var(--border-subtle);
        border-radius: 9px;
        padding: 0.34rem 0.4rem;
        background: rgba(255, 255, 255, 0.03);
    }

    .mobile-menu-toggle .bar {
        width: 18px;
        margin: 4px 0;
    }

    .main-nav {
        width: min(86%, 360px);
    }

    .home-v2 {
        padding-top: 0.95rem;
    }

    .home-v2-hero {
        gap: 0.78rem;
        padding: 0.95rem;
        border-color: rgba(74, 95, 129, 0.74);
        background: linear-gradient(145deg, rgba(8, 15, 29, 0.97), rgba(6, 10, 20, 0.99));
    }

    .home-v2-copy h1 {
        font-size: clamp(1.7rem, 8.2vw, 2.1rem);
        margin-bottom: 0.55rem;
    }

    .home-v2-subtitle {
        font-size: 0.97rem;
        max-width: 40ch;
    }

    .home-v2-note {
        margin: 0.52rem 0 0.78rem;
        font-size: 0.88rem;
    }

    .home-v2-links {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 0.48rem;
        margin-top: 0.72rem;
    }

    .home-v2-links a {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        min-height: 38px;
        border: 1px solid rgba(74, 95, 129, 0.74);
        border-radius: 10px;
        padding: 0.38rem 0.5rem;
        background: rgba(255, 255, 255, 0.02);
        color: #d7e7f8;
        text-decoration: none;
    }

    .home-v2-preview {
        margin-top: 0.15rem;
        padding: 0.72rem;
        border-radius: 11px;
    }

    .home-v2-preview-row {
        padding: 0.58rem 0;
    }

    .home-v2-preview-row:nth-child(n+4) {
        display: none;
    }

    .home-v2-proof,
    .home-v2-sections {
        display: none;
    }

    .home-v2-final {
        margin-top: 0.7rem;
        border-radius: 12px;
        padding: 0.9rem;
        text-align: left;
        background: linear-gradient(145deg, rgba(18, 30, 54, 0.7), rgba(10, 18, 34, 0.55));
    }

    .home-v2-actions-final {
        justify-content: flex-start;
        margin-top: 0.78rem;
    }

    .home-v2-actions-final .btn-primary,
    .home-v2-actions-final .btn-secondary {
        width: 100%;
        min-width: 0;
        min-height: 46px;
    }
}

@media (max-width: 640px) {
    .mobile-top-actions {
        gap: 0.3rem;
        margin-right: 0.3rem;
    }

    .mobile-auth-shortcut {
        min-width: 0;
        padding: 0.34rem 0.56rem;
        font-size: 0.7rem;
    }

    .mobile-dock {
        gap: 0.34rem;
        padding: 0.5rem 0.44rem calc(0.54rem + env(safe-area-inset-bottom));
    }

    .mobile-dock-link {
        min-height: 44px;
        border-radius: 8px;
        font-size: 0.6rem;
    }

    .mobile-dock-text {
        letter-spacing: 0;
    }
}

@media (max-width: 430px) {
    .logo .beta-tag {
        display: none;
    }

    .home-v2-links {
        grid-template-columns: 1fr;
    }
}

/* Final mobile pass: declutter layout and strengthen navigation clarity */
@media (max-width: 900px) {
    .header-inner {
        gap: 0.45rem;
    }

    .mobile-top-actions {
        margin-right: 0.22rem;
    }

    .mobile-auth-shortcut {
        min-height: 34px;
        padding: 0.32rem 0.58rem;
        font-size: 0.69rem;
        border-radius: 999px;
    }

    .mobile-menu-toggle {
        border: 1px solid rgba(127, 148, 177, 0.42);
        border-radius: 9px;
        background: rgba(2, 6, 23, 0.55);
        padding: 0.32rem 0.4rem;
    }

    .main-nav {
        width: min(92%, 400px);
        padding: calc(0.72rem + env(safe-area-inset-top)) 0.9rem 0.9rem;
    }

    .nav-mobile-auth {
        gap: 0.42rem;
        padding-bottom: 0.72rem;
    }

    .nav-mobile-auth .nav-mobile-auth-btn {
        min-height: 44px;
        font-size: 0.88rem;
    }

    .nav-links {
        gap: 0.1rem;
    }

    .nav-link {
        min-height: 42px;
        padding: 0.68rem 0.72rem;
        border-radius: 9px;
    }

    .nav-link-text {
        font-size: 0.95rem;
    }

    .nav-utils {
        gap: 0.68rem;
        margin-top: 0.45rem;
        padding-top: 0.62rem;
    }

    .home-v2 {
        padding-top: 0.72rem;
        padding-bottom: 1.1rem;
    }

    .home-v2-hero {
        gap: 0.68rem;
        padding: 0.88rem;
        border-radius: 12px;
    }

    .home-v2-copy h1 {
        font-size: clamp(1.58rem, 7.5vw, 1.96rem);
        margin-bottom: 0.46rem;
    }

    .home-v2-subtitle {
        font-size: 0.93rem;
        line-height: 1.45;
    }

    .home-v2-note {
        margin: 0.42rem 0 0.68rem;
        font-size: 0.82rem;
    }

    .home-v2-links,
    .home-v2-proof,
    .home-v2-sections,
    .home-v2-final {
        display: none;
    }

    .home-v2-preview {
        margin-top: 0.1rem;
        padding: 0.68rem;
        border-radius: 10px;
        border-color: rgba(74, 95, 129, 0.62);
        background: linear-gradient(180deg, rgba(11, 20, 36, 0.78), rgba(8, 15, 28, 0.88));
    }

    .home-v2-preview-head p {
        margin: 0.24rem 0 0.52rem;
        font-size: 0.77rem;
    }

    .home-v2-preview-row {
        padding: 0.54rem 0;
    }

    .home-v2-preview-row:nth-child(n+3) {
        display: none;
    }

    .market-directory-page .table-container,
    .companies-page .table-container,
    .public-portfolio-page .public-holdings-container {
        margin-bottom: 1rem;
    }

    .market-directory-page .market-table tr,
    .companies-page .market-table tr,
    .public-portfolio-page .public-holdings-table tr {
        margin-bottom: 0.54rem;
        border-radius: 10px;
        border-color: rgba(74, 95, 129, 0.64);
        background: linear-gradient(180deg, rgba(12, 20, 36, 0.9), rgba(8, 14, 27, 0.9));
        box-shadow: none;
    }

    .market-directory-page .market-table td,
    .companies-page .market-table td,
    .public-portfolio-page .public-holdings-table td {
        padding: 0.58rem 0.68rem;
        gap: 0.16rem 0.58rem;
        font-size: 0.89rem;
    }

    .market-directory-page .market-table td::before,
    .companies-page .market-table td::before,
    .public-portfolio-page .public-holdings-table td::before {
        font-size: 0.64rem;
    }

    .market-directory-page .market-table td.ticker-cell strong,
    .public-portfolio-page .public-holdings-table td strong {
        font-size: 0.92rem;
    }

    .public-portfolio-page .holding-name {
        font-size: 0.75rem;
        line-height: 1.32;
    }
}

@media (max-width: 430px) {
    .mobile-auth-shortcut {
        font-size: 0.65rem;
        padding: 0.28rem 0.5rem;
        min-height: 32px;
    }

    .home-v2-copy h1 {
        font-size: clamp(1.44rem, 8vw, 1.8rem);
    }

    .home-v2-subtitle {
        font-size: 0.88rem;
    }

    .home-v2-preview-row:nth-child(n+2) {
        display: none;
    }

    .main-nav {
        width: min(94%, 360px);
    }
}

/* Final mobile pass: social + companies simplification */
@media (max-width: 900px) {
    .social-page .social-header {
        padding-bottom: 0.55rem;
    }

    .social-page .social-header .subtitle {
        font-size: 0.9rem;
        line-height: 1.42;
        max-width: 58ch;
    }

    .social-page .social-table-container {
        margin-bottom: 1rem;
    }

    .social-page .social-table tr {
        margin-bottom: 0.52rem;
        border-radius: 10px;
        border-color: rgba(74, 95, 129, 0.62);
        background: linear-gradient(180deg, rgba(12, 20, 36, 0.9), rgba(8, 14, 27, 0.9));
        box-shadow: none;
    }

    .social-page .social-table td {
        padding: 0.54rem 0.64rem;
        gap: 0.14rem 0.52rem;
        font-size: 0.87rem;
    }

    .social-page .social-table td::before {
        font-size: 0.62rem;
        color: #c7d7ea;
    }

    .social-page .social-table td:first-child {
        background: transparent;
    }

    .social-page .portfolio-risk-label {
        font-size: 0.67rem;
        margin-top: 0.12rem;
    }

    .social-page .social-actions {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 0.38rem;
        width: 100%;
    }

    .social-page .social-follow-form {
        width: 100%;
        display: block;
    }

    .social-page .social-follow-form .social-follow-btn,
    .social-page .action-link {
        width: 100%;
        min-height: 38px;
        border-radius: 8px;
        font-size: 0.73rem;
        padding: 0.3rem 0.5rem;
        text-align: center;
        justify-content: center;
    }

    .social-page .social-actions-cell {
        padding-top: 0.42rem;
    }

    .companies-page .directory-header {
        padding-bottom: 0.58rem;
    }

    .companies-page .directory-header .subtitle {
        font-size: 0.9rem;
        line-height: 1.4;
    }

    .companies-page .directory-meta {
        margin-bottom: 0.45rem;
        font-size: 0.76rem;
    }

    .companies-page .market-search {
        margin-bottom: 0.55rem;
        min-height: 40px;
        font-size: 0.9rem;
    }

    .companies-page .letter-filter {
        margin-top: 0.48rem;
        gap: 0.34rem;
        padding-bottom: 0.18rem;
        flex-wrap: nowrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .companies-page .letter-chip {
        min-height: 34px;
        min-width: 34px;
        padding: 0 0.58rem;
        font-size: 0.72rem;
        border-radius: 999px;
        background: rgba(255, 255, 255, 0.03);
    }

    .companies-page .table-container {
        margin-bottom: 0.9rem;
    }

    .companies-page .market-table tr {
        margin-bottom: 0.5rem;
        border-radius: 10px;
        border-color: rgba(74, 95, 129, 0.62);
        background: linear-gradient(180deg, rgba(12, 20, 36, 0.9), rgba(8, 14, 27, 0.9));
        box-shadow: none;
    }

    .companies-page .market-table td {
        padding: 0.54rem 0.62rem;
        gap: 0.14rem 0.52rem;
        font-size: 0.86rem;
    }

    .companies-page .market-table td::before {
        font-size: 0.62rem;
    }

    .companies-page .market-table td:first-child strong {
        font-size: 0.91rem;
    }

    .companies-page .market-table td:nth-child(2) {
        color: var(--text-secondary);
        line-height: 1.32;
    }
}

@media (max-width: 430px) {
    .social-page .social-actions {
        grid-template-columns: 1fr;
    }

    .social-page .social-table td {
        padding: 0.5rem 0.58rem;
        font-size: 0.84rem;
    }

    .companies-page .letter-chip {
        min-height: 32px;
        min-width: 32px;
        padding: 0 0.5rem;
        font-size: 0.68rem;
    }

    .companies-page .market-table td {
        padding: 0.5rem 0.56rem;
        font-size: 0.83rem;
    }
}

/* Final mobile pass: stock detail + profile simplification */
@media (max-width: 900px) {
    .stock-detail-page .stock-detail-header {
        padding-bottom: 0.62rem;
    }

    .stock-detail-page .stock-detail-header .subtitle {
        font-size: 0.88rem;
        line-height: 1.42;
        margin-top: 0.3rem;
    }

    .stock-detail-page .stock-quote-line {
        gap: 0.24rem;
        margin-top: 0.32rem;
    }

    .stock-detail-page .quote-price {
        font-size: 1.36rem;
        line-height: 1.16;
    }

    .stock-detail-page .quote-change {
        font-size: 0.84rem;
    }

    .stock-detail-page .quote-meta {
        font-size: 0.72rem;
    }

    .stock-detail-page .stock-insights-grid {
        gap: 0.62rem;
        margin: 0.72rem 0 0.92rem;
    }

    .stock-detail-page .stock-insight-card {
        border-radius: 10px;
        padding: 0.72rem;
        border-color: rgba(74, 95, 129, 0.54);
        background: rgba(12, 22, 40, 0.76);
    }

    .stock-detail-page .stock-insight-card h2 {
        font-size: 0.84rem;
        margin-bottom: 0.5rem;
    }

    .stock-detail-page .insight-meta {
        margin: 0.14rem 0 0.52rem;
        font-size: 0.7rem;
    }

    .stock-detail-page .insight-kv {
        gap: 0.55rem;
        padding: 0.34rem 0;
        font-size: 0.76rem;
    }

    .stock-detail-page .score-matrix {
        gap: 0.34rem;
        grid-template-columns: 1fr repeat(3, minmax(0, 1fr));
    }

    .stock-detail-page .score-cell {
        border-radius: 7px;
        padding: 0.34rem 0.28rem;
        font-size: 0.74rem;
    }

    .stock-detail-page .score-label {
        font-size: 0.74rem;
    }

    .stock-detail-page .dividend-pill {
        margin-bottom: 0.5rem;
        padding: 0.24rem 0.58rem;
        font-size: 0.68rem;
    }

    .stock-detail-page .dividend-metrics {
        grid-template-columns: 1fr 1fr;
        gap: 0.36rem;
    }

    .stock-detail-page .dividend-summary-grid {
        grid-template-columns: 1fr;
        gap: 0.36rem;
        margin-bottom: 0.36rem;
    }

    .stock-detail-page .metric-box {
        padding: 0.42rem;
        border-radius: 7px;
    }

    .stock-detail-page .metric-box span {
        font-size: 0.64rem;
    }

    .stock-detail-page .metric-box strong {
        font-size: 0.83rem;
    }

    .stock-detail-page .projection-grid {
        gap: 0.4rem;
    }

    .stock-detail-page .projection-row {
        border-radius: 7px;
        padding: 0.42rem 0.5rem;
        gap: 0.12rem 0.5rem;
    }

    .stock-detail-page .projection-label {
        font-size: 0.72rem;
    }

    .stock-detail-page .projection-price {
        font-size: 0.8rem;
    }

    .stock-detail-page .projection-meta,
    .stock-detail-page .projection-range {
        font-size: 0.66rem;
    }

    .stock-detail-page .stock-detail-actions {
        gap: 0.48rem;
        margin-bottom: 0.9rem;
    }

    .stock-detail-page .related-sector-section {
        margin-top: 0.92rem;
        padding-top: 0.84rem;
    }

    .stock-detail-page .related-sector-title {
        margin: 0 0 0.54rem;
        font-size: 0.88rem;
    }

    .profile-page .profile-container {
        margin: 0.95rem auto 1.4rem;
    }

    .profile-page .profile-section {
        border-radius: 10px;
        padding: 0.86rem;
        background: rgba(12, 22, 40, 0.74);
        border-color: rgba(74, 95, 129, 0.5);
        box-shadow: none;
    }

    .profile-page .profile-section h2 {
        margin-bottom: 0.62rem;
        font-size: 0.95rem;
    }

    .profile-page .form-group {
        margin-bottom: 0.66rem;
    }

    .profile-page .form-group label {
        font-size: 0.78rem;
        margin-bottom: 0.34rem;
    }

    .profile-page .form-group input[type="text"],
    .profile-page .form-group select {
        min-height: 42px;
        padding: 0.6rem 0.7rem;
        font-size: 0.92rem;
    }

    .profile-page .checkbox-group {
        font-size: 0.88rem;
    }

    .profile-page .delete-help-text {
        font-size: 0.82rem;
    }

    .profile-page .btn-save,
    .profile-page .btn-delete {
        min-height: 42px;
        font-size: 0.9rem;
        border-radius: 9px;
    }
}

@media (max-width: 430px) {
    .stock-detail-page .quote-price {
        font-size: 1.24rem;
    }

    .stock-detail-page .quote-change {
        font-size: 0.8rem;
    }

    .stock-detail-page .stock-insight-card {
        padding: 0.64rem;
    }

    .stock-detail-page .score-matrix {
        grid-template-columns: 1fr 1fr;
    }

    .stock-detail-page .score-head {
        font-size: 0.62rem;
    }

    .stock-detail-page .dividend-metrics {
        grid-template-columns: 1fr;
    }

    .stock-detail-page .projection-row {
        grid-template-columns: 1fr;
    }

    .stock-detail-page .projection-price,
    .stock-detail-page .projection-meta,
    .stock-detail-page .projection-range {
        text-align: left;
        grid-column: auto;
    }

    .profile-page .profile-section {
        padding: 0.74rem;
    }

    .profile-page .profile-section h2 {
        font-size: 0.9rem;
    }

    .profile-page .form-group input[type="text"],
    .profile-page .form-group select {
        min-height: 40px;
        font-size: 0.88rem;
    }

    .profile-page .btn-save,
    .profile-page .btn-delete {
        min-height: 40px;
        font-size: 0.86rem;
    }
}

/* Professional pass: cleaner landing and clearer mobile navigation */
.home-v2-sections {
    display: none;
}

.home-v2-proof {
    margin-top: 0.9rem;
    padding-top: 0.45rem;
    padding-bottom: 0.45rem;
    border-top: 1px solid rgba(127, 148, 177, 0.16);
    border-bottom: 1px solid rgba(127, 148, 177, 0.16);
}

.home-v2-final {
    margin-top: 1rem;
    border-color: rgba(71, 100, 139, 0.58);
    background: linear-gradient(125deg, rgba(16, 27, 46, 0.64), rgba(8, 15, 27, 0.58));
}

@media (max-width: 900px) {
    :root {
        --text-secondary: #d6e2f1;
        --text-muted: #b2c3da;
    }

    header {
        border-bottom-color: rgba(116, 139, 171, 0.36);
        background: linear-gradient(180deg, rgba(6, 12, 24, 0.97) 0%, rgba(5, 10, 20, 0.96) 100%);
    }

    .header-inner {
        min-height: 64px;
        gap: 0.5rem;
        padding: 0 0.78rem;
    }

    .mobile-top-actions {
        margin-left: auto;
        margin-right: 0.3rem;
        gap: 0.36rem;
    }

    .mobile-auth-shortcut {
        min-height: 38px;
        border-radius: 999px;
        padding: 0.38rem 0.72rem;
        font-size: 0.76rem;
        letter-spacing: 0.01em;
        border-color: rgba(123, 149, 182, 0.55);
        background: rgba(255, 255, 255, 0.05);
        color: #f1f6ff;
    }

    .mobile-auth-shortcut.login {
        border-color: rgba(147, 197, 253, 0.66);
        background: rgba(30, 64, 175, 0.3);
    }

    .mobile-auth-shortcut.account {
        border-color: rgba(110, 231, 183, 0.62);
        background: rgba(6, 95, 70, 0.3);
        color: #e6fff3;
    }

    .mobile-menu-toggle {
        width: 40px;
        height: 40px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        border: 1px solid rgba(127, 148, 177, 0.48);
        border-radius: 10px;
        padding: 0;
        background: rgba(2, 6, 23, 0.56);
    }

    .mobile-menu-toggle .bar {
        width: 18px;
        margin: 3px 0;
    }

    .main-nav {
        width: min(94vw, 390px);
        padding: calc(0.72rem + env(safe-area-inset-top)) 0.95rem 0.95rem;
        background: linear-gradient(180deg, rgba(8, 16, 30, 0.98), rgba(10, 19, 34, 0.98));
    }

    .nav-mobile-head {
        position: sticky;
        top: calc(-0.72rem - env(safe-area-inset-top));
        z-index: 2;
        background: linear-gradient(180deg, rgba(8, 16, 30, 0.99), rgba(8, 16, 30, 0.95));
        margin: calc(-0.72rem - env(safe-area-inset-top)) -0.95rem 0.6rem;
        padding: calc(0.72rem + env(safe-area-inset-top)) 0.95rem 0.65rem;
    }

    .nav-mobile-auth {
        gap: 0.48rem;
        margin-top: 0;
        padding-bottom: 0.78rem;
    }

    .nav-mobile-auth .nav-mobile-auth-btn {
        min-height: 46px;
        border-radius: 12px;
        font-size: 0.92rem;
    }

    .nav-link {
        min-height: 46px;
        border-radius: 10px;
        padding: 0.74rem 0.78rem;
    }

    .nav-link-text {
        font-size: 0.97rem;
    }

    .nav-link.active {
        background: rgba(57, 194, 255, 0.16);
        border-color: rgba(57, 194, 255, 0.4);
    }

    .nav-utils {
        margin-top: 0.58rem;
        padding-top: 0.72rem;
        gap: 0.72rem;
    }

    .home-v2 {
        padding-top: 0.86rem;
        padding-bottom: 1rem;
    }

    .home-v2-hero {
        border-radius: 14px;
        padding: 1rem;
        gap: 0.8rem;
        border-color: rgba(80, 106, 141, 0.55);
        background: linear-gradient(145deg, rgba(8, 16, 30, 0.96), rgba(5, 11, 21, 0.98));
    }

    .home-v2-copy h1 {
        font-size: clamp(1.62rem, 7.2vw, 2rem);
        line-height: 1.14;
    }

    .home-v2-subtitle {
        color: #e6effb;
        font-size: 0.95rem;
        line-height: 1.5;
    }

    .home-v2-note {
        margin: 0.45rem 0 0.76rem;
        color: #c9d9ec;
        font-size: 0.84rem;
    }

    .home-v2-preview {
        margin-top: 0.12rem;
        border-radius: 11px;
        border-color: rgba(76, 99, 130, 0.45);
        background: rgba(10, 18, 32, 0.74);
        padding: 0.75rem;
    }

    .home-v2-preview-row {
        padding: 0.6rem 0;
    }

    .home-v2-preview-row:nth-child(n+3) {
        display: none;
    }

    .home-v2-final {
        display: block;
        border-radius: 12px;
        padding: 0.92rem;
        margin-top: 0.72rem;
    }

    .home-v2-final p {
        font-size: 0.9rem;
    }

    .home-v2-actions-final {
        margin-top: 0.72rem;
    }

    .home-v2-actions-final .btn-primary,
    .home-v2-actions-final .btn-secondary {
        width: 100%;
        min-height: 46px;
    }

    .mobile-dock {
        gap: 0.24rem;
        padding: 0.52rem 0.48rem calc(0.56rem + env(safe-area-inset-bottom));
        border-top-color: rgba(116, 139, 171, 0.3);
        background: linear-gradient(180deg, rgba(4, 9, 19, 0.97), rgba(3, 7, 15, 0.98));
    }

    .mobile-dock-link {
        min-height: 48px;
        border: 1px solid transparent;
        background: transparent;
        border-radius: 10px;
        padding: 0.24rem 0.1rem;
    }

    .mobile-dock-link.active {
        border-color: rgba(57, 194, 255, 0.4);
        background: rgba(57, 194, 255, 0.14);
    }

    .mobile-dock-link.is-auth {
        border-color: rgba(147, 197, 253, 0.5);
        background: rgba(30, 64, 175, 0.24);
    }

    .mobile-dock-link.is-logout {
        border-color: rgba(248, 113, 113, 0.5);
        background: rgba(127, 29, 29, 0.24);
    }

    .mobile-dock-icon {
        width: 1.04rem;
        height: 1.04rem;
    }

    .mobile-dock-text {
        font-size: 0.67rem;
        letter-spacing: 0.01em;
    }
}

@media (max-width: 430px) {
    .mobile-auth-shortcut {
        min-height: 36px;
        padding: 0.32rem 0.62rem;
        font-size: 0.72rem;
    }

    .main-nav {
        width: 96vw;
    }

    .mobile-dock {
        gap: 0.18rem;
        padding-left: 0.35rem;
        padding-right: 0.35rem;
    }

    .mobile-dock-link {
        min-height: 46px;
        border-radius: 9px;
        padding: 0.2rem 0.06rem;
    }

    .mobile-dock-text {
        font-size: 0.6rem;
    }

    .home-v2-copy h1 {
        font-size: clamp(1.5rem, 8.2vw, 1.82rem);
    }
}

/* Global mobile simplification: cleaner list rhythm on data-heavy pages */
@media (max-width: 900px) {
    .market-directory-page .table-container,
    .companies-page .table-container,
    .social-page .social-table-container,
    .public-portfolio-page .public-holdings-container {
        border: 1px solid rgba(74, 95, 129, 0.3);
        border-radius: 12px;
        background: rgba(8, 14, 26, 0.42);
        overflow: hidden;
        margin-bottom: 0.85rem;
    }

    .market-directory-page .market-table tr,
    .companies-page .market-table tr,
    .social-page .social-table tr,
    .public-portfolio-page .public-holdings-table tr {
        margin-bottom: 0 !important;
        border: 0 !important;
        border-bottom: 1px solid rgba(74, 95, 129, 0.26) !important;
        border-radius: 0 !important;
        background: transparent !important;
        box-shadow: none !important;
    }

    .market-directory-page .market-table tr:last-child,
    .companies-page .market-table tr:last-child,
    .social-page .social-table tr:last-child,
    .public-portfolio-page .public-holdings-table tr:last-child {
        border-bottom: 0 !important;
    }

    .market-directory-page .market-table td,
    .companies-page .market-table td,
    .social-page .social-table td,
    .public-portfolio-page .public-holdings-table td {
        padding: 0.54rem 0.64rem !important;
        border-bottom: 1px solid rgba(74, 95, 129, 0.18) !important;
        background: transparent !important;
    }

    .market-directory-page .market-table td:last-child,
    .companies-page .market-table td:last-child,
    .social-page .social-table td:last-child,
    .public-portfolio-page .public-holdings-table td:last-child {
        border-bottom: 0 !important;
    }

    .market-directory-page .market-table td.ticker-cell,
    .companies-page .market-table td:first-child,
    .social-page .social-table td:first-child,
    .public-portfolio-page .public-holdings-table td:first-child {
        background: transparent !important;
    }
}

@media (max-width: 430px) {
    .market-directory-page .market-table td,
    .companies-page .market-table td,
    .social-page .social-table td,
    .public-portfolio-page .public-holdings-table td {
        padding: 0.5rem 0.58rem !important;
    }
}

/* Mobile professional pass: simplified hierarchy and stronger readability */
@media (max-width: 900px) {
    :root {
        --text-secondary: #d9e4f4;
        --text-muted: #bfd0e6;
    }

    .header-inner {
        min-height: 66px;
    }

    .logo {
        font-size: 1.04rem;
    }

    .mobile-top-actions {
        gap: 0.34rem;
        margin-right: 0.18rem;
    }

    .mobile-auth-shortcut {
        min-height: 36px;
        padding: 0.34rem 0.58rem;
        font-size: 0.68rem;
        font-weight: 800;
    }

    .mobile-auth-shortcut.account {
        background: rgba(13, 64, 44, 0.34);
        border-color: rgba(134, 239, 172, 0.56);
        color: #e7fff2;
    }

    .mobile-auth-shortcut.logout {
        background: rgba(120, 32, 32, 0.34);
        border-color: rgba(248, 113, 113, 0.6);
        color: #ffe3e3;
    }

    .mobile-auth-shortcut.login {
        background: rgba(30, 64, 175, 0.34);
        border-color: rgba(147, 197, 253, 0.6);
        color: #eaf3ff;
    }

    .main-nav {
        width: min(92vw, 380px);
    }

    .home-page.home-v2 {
        padding-top: 0.82rem;
        padding-bottom: 1.2rem;
    }

    .home-v2-hero {
        border-radius: 14px;
        padding: 1rem;
        gap: 0.82rem;
        background: linear-gradient(150deg, rgba(8, 16, 30, 0.95), rgba(6, 12, 22, 0.98));
        border: 1px solid rgba(98, 127, 165, 0.58);
    }

    .home-v2-copy h1 {
        font-size: clamp(1.66rem, 7.7vw, 2.06rem);
        line-height: 1.13;
    }

    .home-v2-subtitle {
        font-size: 0.97rem;
        line-height: 1.5;
        color: #e9f1fc;
    }

    .home-v2-note {
        font-size: 0.87rem;
        color: #cfdcf0;
        margin: 0.48rem 0 0.78rem;
    }

    .home-v2-actions {
        gap: 0.52rem;
        margin-top: 0.74rem;
    }

    .home-v2-actions .btn-primary,
    .home-v2-actions .btn-secondary {
        width: 100%;
        min-height: 46px;
    }

    .home-v2-links {
        display: grid;
        grid-template-columns: 1fr;
        gap: 0.34rem;
        margin-top: 0.68rem;
    }

    .home-v2-links a {
        justify-content: flex-start;
        border: 1px solid rgba(97, 122, 155, 0.56);
        border-radius: 10px;
        padding: 0.44rem 0.62rem;
        background: rgba(10, 20, 35, 0.52);
        color: #deebfb;
    }

    .home-v2-preview {
        border: 0;
        border-top: 1px solid rgba(114, 140, 176, 0.36);
        border-radius: 0;
        padding: 0.72rem 0 0;
        margin-top: 0.02rem;
        background: transparent;
        backdrop-filter: none;
    }

    .home-v2-preview-head h2 {
        font-size: 0.92rem;
    }

    .home-v2-preview-head p {
        font-size: 0.78rem;
        color: #c7d9ef;
        margin: 0.2rem 0 0.5rem;
    }

    .home-v2-preview-list {
        border-top: 1px solid rgba(102, 126, 160, 0.34);
        border-bottom: 0;
    }

    .home-v2-preview-row {
        padding: 0.56rem 0;
        border-bottom: 1px solid rgba(90, 113, 145, 0.34);
    }

    .home-v2-preview-row:nth-child(n+3) {
        display: none;
    }

    .home-v2-preview-row:hover {
        background: transparent;
    }

    .home-v2-preview-footer {
        margin-top: 0.58rem;
    }

    .home-v2-preview-footer .btn-secondary {
        min-height: 42px;
    }

    .home-v2-proof,
    .home-v2-sections,
    .home-v2-final {
        display: none;
    }

    .market-directory-page .directory-header,
    .companies-page .directory-header {
        padding: 1.15rem 0 0.58rem;
    }

    .market-directory-page .directory-header h1,
    .companies-page .directory-header h1 {
        font-size: clamp(1.34rem, 6.5vw, 1.72rem);
    }

    .market-directory-page .directory-header .subtitle,
    .companies-page .directory-header .subtitle {
        font-size: 0.92rem;
        line-height: 1.44;
        margin-bottom: 0.5rem;
        color: #d8e5f5;
    }

    .market-directory-page .directory-meta,
    .companies-page .directory-meta {
        font-size: 0.79rem;
        margin: 0.2rem 0 0.52rem;
        color: #c0d2e8;
    }

    .market-directory-page .table-container,
    .companies-page .table-container {
        border: 1px solid rgba(90, 114, 145, 0.34);
        border-radius: 12px;
        background: rgba(8, 14, 25, 0.38);
        overflow: hidden;
    }

    .market-directory-page .market-table tr,
    .companies-page .market-table tr {
        margin: 0 !important;
        border: 0 !important;
        border-bottom: 1px solid rgba(90, 114, 145, 0.3) !important;
        border-radius: 0 !important;
        background: transparent !important;
    }

    .market-directory-page .market-table tr:last-child,
    .companies-page .market-table tr:last-child {
        border-bottom: 0 !important;
    }

    .market-directory-page .market-table td,
    .companies-page .market-table td {
        grid-template-columns: minmax(76px, 92px) minmax(0, 1fr);
        padding: 0.6rem 0.68rem !important;
        gap: 0.14rem 0.62rem;
        font-size: 0.9rem !important;
        border-bottom: 1px solid rgba(90, 114, 145, 0.16) !important;
    }

    .market-directory-page .market-table td:last-child,
    .companies-page .market-table td:last-child {
        border-bottom: 0 !important;
    }

    .market-directory-page .market-table td::before,
    .companies-page .market-table td::before {
        font-size: 0.63rem;
        color: #c4d5ea;
    }

    .market-directory-page .market-table td.ticker-cell strong,
    .companies-page .market-table td:first-child strong {
        font-size: 0.98rem;
    }

    .market-directory-page .market-table td.name-cell .company-name,
    .companies-page .market-table td:nth-child(2) {
        color: #dce8f8;
        line-height: 1.34;
    }

    .market-directory-page .market-table td .badge-mini {
        font-size: 0.7rem;
        letter-spacing: 0.03em;
        padding: 0.18rem 0.48rem;
    }

    .companies-page .market-search,
    .market-directory-page .market-search {
        min-height: 42px;
        font-size: 0.93rem;
        margin-bottom: 0.55rem;
    }

    .companies-page .letter-filter {
        margin-top: 0.5rem;
        gap: 0.34rem;
    }

    .companies-page .letter-chip {
        min-height: 34px;
        min-width: 34px;
        font-size: 0.72rem;
        padding: 0 0.56rem;
    }

    .stock-detail-page .directory-header.stock-detail-header {
        padding: 1rem 0 0.56rem;
    }

    .stock-detail-page .stock-detail-header h1 {
        font-size: clamp(1.2rem, 5.5vw, 1.55rem);
        line-height: 1.25;
    }

    .stock-detail-page .stock-quote-line {
        margin-top: 0.3rem;
        gap: 0.3rem;
    }

    .stock-detail-page .quote-price {
        font-size: 1.34rem;
    }

    .stock-detail-page .quote-change {
        font-size: 0.86rem;
        font-weight: 700;
    }

    .stock-detail-page .quote-meta {
        font-size: 0.73rem;
        color: #bfd2e9;
    }

    .stock-detail-page .stock-trust-stats {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 0.45rem;
        margin-top: 0.64rem;
    }

    .stock-detail-page .stock-trust-stats .t-stat {
        min-height: 52px;
        border-radius: 10px;
    }

    .stock-detail-page .stock-insights-grid {
        gap: 0.62rem;
        margin: 0.68rem 0 0.9rem;
    }

    .stock-detail-page .stock-insight-card {
        border-radius: 11px;
        padding: 0.76rem;
        border: 1px solid rgba(94, 118, 149, 0.45);
        background: rgba(9, 16, 29, 0.66);
    }

    .stock-detail-page .stock-insight-card h2 {
        font-size: 0.9rem;
        margin-bottom: 0.52rem;
    }

    .stock-detail-page .insight-kv {
        padding: 0.36rem 0;
        font-size: 0.8rem;
    }

    .stock-detail-page .score-matrix {
        gap: 0.34rem;
    }

    .stock-detail-page .score-cell {
        border-radius: 7px;
        font-size: 0.75rem;
        padding: 0.34rem 0.3rem;
    }

    .stock-detail-page .stock-detail-actions {
        gap: 0.52rem;
        margin-bottom: 0.96rem;
    }

    .stock-detail-page .stock-detail-actions .btn-primary,
    .stock-detail-page .stock-detail-actions .btn-secondary {
        width: 100%;
        min-width: 0;
        min-height: 44px;
    }
}

@media (max-width: 430px) {
    .mobile-auth-shortcut {
        font-size: 0.65rem;
        min-height: 34px;
        padding: 0.28rem 0.5rem;
    }

    .home-v2-copy h1 {
        font-size: clamp(1.48rem, 8.3vw, 1.82rem);
    }

    .home-v2-subtitle {
        font-size: 0.91rem;
    }

    .home-v2-note {
        font-size: 0.83rem;
    }

    .market-directory-page .market-table td,
    .companies-page .market-table td {
        padding: 0.54rem 0.6rem !important;
        font-size: 0.86rem !important;
        grid-template-columns: minmax(70px, 84px) minmax(0, 1fr);
    }

    .companies-page .letter-chip {
        min-height: 32px;
        min-width: 32px;
        font-size: 0.68rem;
    }

    .stock-detail-page .stock-insight-card {
        padding: 0.68rem;
    }
}

/* Institutional refinement: landing desktop + social/public mobile usability */
@media (min-width: 901px) {
    .home-page.home-v2 {
        max-width: 1220px;
        padding-top: 2.4rem;
        padding-bottom: 2.2rem;
    }

    .home-v2-hero {
        grid-template-columns: minmax(0, 1.28fr) minmax(0, 0.72fr);
        gap: 1.35rem;
        padding: 2rem;
        border-radius: 22px;
        border: 1px solid rgba(94, 123, 160, 0.62);
        background:
            radial-gradient(circle at 88% 6%, rgba(56, 189, 248, 0.08) 0%, rgba(56, 189, 248, 0) 44%),
            linear-gradient(152deg, rgba(8, 15, 28, 0.98), rgba(6, 11, 21, 0.99));
        box-shadow: 0 24px 50px rgba(0, 0, 0, 0.34);
    }

    .home-v2-copy h1 {
        font-size: clamp(2.22rem, 4.2vw, 3.05rem);
        line-height: 1.08;
        margin-bottom: 0.72rem;
        letter-spacing: -0.02em;
    }

    .home-v2-subtitle {
        max-width: 56ch;
        color: #e6f0fd;
        font-size: 1.04rem;
    }

    .home-v2-note {
        margin: 0.62rem 0 1rem;
        font-size: 0.9rem;
        color: #c6d8ee;
    }

    .home-v2-chip {
        background: rgba(32, 75, 117, 0.28);
        border-color: rgba(97, 152, 204, 0.58);
        color: #d8eaff;
    }

    .home-v2-actions {
        margin-top: 0.86rem;
        gap: 0.56rem;
    }

    .home-v2-actions .btn-primary,
    .home-v2-actions .btn-secondary {
        min-width: 190px;
        min-height: 44px;
    }

    .home-v2-links {
        margin-top: 0.78rem;
        gap: 0.75rem;
    }

    .home-v2-links a {
        font-size: 0.82rem;
        letter-spacing: 0.02em;
    }

    .home-v2-preview {
        border-radius: 16px;
        padding: 1rem 1.05rem;
        background: linear-gradient(180deg, rgba(10, 19, 33, 0.82), rgba(8, 14, 26, 0.88));
        border: 1px solid rgba(83, 108, 139, 0.58);
        backdrop-filter: none;
    }

    .home-v2-preview-head h2 {
        font-size: 0.94rem;
        letter-spacing: 0.02em;
    }

    .home-v2-preview-head p {
        font-size: 0.79rem;
        color: #bed2ea;
        margin: 0.28rem 0 0.68rem;
    }

    .home-v2-preview-row {
        padding: 0.62rem 0;
    }

    .home-v2-row-main {
        margin-bottom: 0.22rem;
    }

    .home-v2-row-ticker {
        font-size: 0.9rem;
    }

    .home-v2-row-rank,
    .home-v2-row-score {
        font-size: 0.72rem;
    }

    .home-v2-preview-footer .btn-secondary {
        min-height: 40px;
        font-size: 0.82rem;
    }
}

@media (max-width: 900px) {
    .social-page .social-header {
        padding: 1rem 0 0.56rem;
    }

    .social-page .social-header h1 {
        font-size: clamp(1.32rem, 6.4vw, 1.7rem);
        line-height: 1.22;
    }

    .social-page .social-header .subtitle {
        margin-top: 0.22rem;
        margin-bottom: 0.52rem;
        font-size: 0.92rem;
        line-height: 1.45;
        color: #d8e5f5;
    }

    .social-page .social-guest-cta {
        width: 100%;
        margin-top: 0.36rem;
    }

    .social-page .social-guest-cta .btn-primary {
        width: 100%;
        min-height: 44px;
    }

    .social-page .social-table-container {
        border: 1px solid rgba(92, 116, 147, 0.34);
        border-radius: 12px;
        background: rgba(8, 14, 26, 0.4);
        overflow: hidden;
    }

    .social-page .social-table tr {
        margin-bottom: 0 !important;
        border: 0 !important;
        border-bottom: 1px solid rgba(92, 116, 147, 0.3) !important;
        border-radius: 0 !important;
        background: transparent !important;
    }

    .social-page .social-table tr:last-child {
        border-bottom: 0 !important;
    }

    .social-page .social-table td {
        padding: 0.58rem 0.66rem !important;
        gap: 0.12rem 0.56rem !important;
        border-bottom: 1px solid rgba(92, 116, 147, 0.16) !important;
        background: transparent !important;
        font-size: 0.88rem !important;
    }

    .social-page .social-table td:last-child {
        border-bottom: 0 !important;
    }

    .social-page .social-table td::before {
        font-size: 0.63rem !important;
        color: #c5d7eb !important;
    }

    .social-page .portfolio-risk-label {
        font-size: 0.69rem;
        color: #bdd1e8;
        margin-top: 0.14rem;
    }

    .social-page .social-actions-cell {
        padding-top: 0.38rem !important;
    }

    .social-page .social-actions {
        display: grid !important;
        grid-template-columns: 1fr !important;
        gap: 0.34rem !important;
        width: 100%;
        justify-content: stretch !important;
    }

    .social-page .social-follow-form {
        width: 100%;
    }

    .social-page .action-link,
    .social-page .social-follow-form .social-follow-btn {
        width: 100%;
        min-height: 40px;
        border-radius: 9px;
        font-size: 0.76rem;
        font-weight: 700;
        justify-content: center;
        text-align: center;
        padding: 0.3rem 0.52rem;
    }

    .public-portfolio-page .public-portfolio-head {
        padding: 1rem 0 0.54rem;
    }

    .public-portfolio-page .public-portfolio-head h1 {
        font-size: clamp(1.24rem, 5.8vw, 1.56rem);
        line-height: 1.24;
    }

    .public-portfolio-page .public-portfolio-head .subtitle {
        margin-top: 0.18rem;
        margin-bottom: 0.48rem;
        font-size: 0.9rem;
        line-height: 1.43;
        color: #d4e2f3;
    }

    .public-portfolio-page .public-follow-form,
    .public-portfolio-page .public-portfolio-head > .btn-primary {
        width: 100%;
    }

    .public-portfolio-page .public-follow-form .btn-primary,
    .public-portfolio-page .public-portfolio-head > .btn-primary {
        width: 100%;
        min-height: 44px;
    }

    .public-portfolio-page .top-stats {
        gap: 0.46rem !important;
        margin-bottom: 0.66rem !important;
    }

    .public-portfolio-page .eval-panel,
    .public-portfolio-page .value-panel {
        border-radius: 10px !important;
        border: 1px solid rgba(92, 116, 147, 0.34) !important;
        background: rgba(8, 14, 26, 0.46) !important;
        padding: 0.62rem 0.7rem !important;
    }

    .public-portfolio-page .eval-score {
        font-size: 1.86rem !important;
        margin-top: 0.08rem !important;
    }

    .public-portfolio-page .value-amount {
        font-size: 1.58rem !important;
        margin-top: 0.08rem !important;
    }

    .public-portfolio-page .chart-container {
        border-radius: 10px !important;
        border: 1px solid rgba(92, 116, 147, 0.3) !important;
        background: rgba(8, 14, 26, 0.28) !important;
        padding: 0.7rem !important;
        margin-bottom: 0.7rem !important;
    }

    .public-portfolio-page .public-holdings-container {
        border: 1px solid rgba(92, 116, 147, 0.34) !important;
        border-radius: 12px !important;
        background: rgba(8, 14, 26, 0.4) !important;
        overflow: hidden;
        margin-bottom: 1rem !important;
    }

    .public-portfolio-page .public-holdings-table tr {
        margin-bottom: 0 !important;
        border: 0 !important;
        border-bottom: 1px solid rgba(92, 116, 147, 0.3) !important;
        border-radius: 0 !important;
        background: transparent !important;
    }

    .public-portfolio-page .public-holdings-table tr:last-child {
        border-bottom: 0 !important;
    }

    .public-portfolio-page .public-holdings-table td {
        padding: 0.58rem 0.66rem !important;
        gap: 0.12rem 0.56rem !important;
        border-bottom: 1px solid rgba(92, 116, 147, 0.16) !important;
        background: transparent !important;
        font-size: 0.88rem !important;
    }

    .public-portfolio-page .public-holdings-table td:last-child {
        border-bottom: 0 !important;
    }

    .public-portfolio-page .public-holdings-table td::before {
        font-size: 0.63rem !important;
        color: #c5d7eb !important;
    }

    .public-portfolio-page .public-holdings-table td strong {
        font-size: 0.96rem;
    }

    .public-portfolio-page .holding-name {
        font-size: 0.74rem;
        color: #c1d4ea;
    }
}

@media (max-width: 430px) {
    .social-page .social-table td,
    .public-portfolio-page .public-holdings-table td {
        padding: 0.52rem 0.58rem !important;
        font-size: 0.84rem !important;
    }

    .social-page .action-link,
    .social-page .social-follow-form .social-follow-btn,
    .public-portfolio-page .public-follow-form .btn-primary,
    .public-portfolio-page .public-portfolio-head > .btn-primary {
        min-height: 38px;
        font-size: 0.72rem;
    }
}

/* Mobile navigation IA pass: keep auth 1-tap and reduce dock clutter */
@media (max-width: 900px) {
    .mobile-top-actions {
        display: inline-flex;
        flex-wrap: nowrap;
        align-items: center;
    }

    .mobile-auth-shortcut {
        white-space: nowrap;
        text-decoration: none;
    }

    .mobile-dock,
    .mobile-dock.is-authenticated,
    .mobile-dock.is-guest {
        grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
    }

    .mobile-dock-link {
        min-height: 46px;
    }
}

@media (max-width: 430px) {
    .mobile-top-actions {
        gap: 0.24rem;
    }

    .mobile-auth-shortcut {
        min-height: 34px;
        padding: 0.26rem 0.48rem;
        font-size: 0.68rem;
        font-weight: 800;
    }
}

/* Final contrast pass: mobile auth/navigation/profile readability */
@media (max-width: 900px) {
    .mobile-auth-shortcut {
        min-height: 36px;
        font-size: 0.71rem;
        letter-spacing: 0.01em;
    }

    .mobile-dock-link {
        min-height: 48px;
    }

    .mobile-dock-text {
        font-size: 0.68rem;
        letter-spacing: 0.01em;
    }

    .profile-page .profile-section {
        background: rgba(10, 18, 33, 0.78);
        border-color: rgba(92, 116, 147, 0.52);
    }

    .profile-page .form-group label {
        color: #d8e5f5;
        font-size: 0.8rem;
    }

    .profile-page .form-group input[type="text"],
    .profile-page .form-group select {
        border-color: rgba(92, 116, 147, 0.6);
        min-height: 44px;
        font-size: 0.94rem;
    }

    .profile-page .checkbox-group {
        border-color: rgba(92, 116, 147, 0.52);
        background: rgba(255, 255, 255, 0.03);
    }

    .profile-page .btn-save,
    .profile-page .btn-delete {
        min-height: 44px;
        font-size: 0.92rem;
    }
}

@media (max-width: 430px) {
    .mobile-auth-shortcut {
        min-height: 34px;
        font-size: 0.67rem;
    }

    .mobile-dock-text {
        font-size: 0.64rem;
    }

    .profile-page .form-group label {
        font-size: 0.78rem;
    }

    .profile-page .form-group input[type="text"],
    .profile-page .form-group select {
        min-height: 42px;
        font-size: 0.9rem;
    }
}

/* Final mobile consistency pass: social/public tables align with portfolio rhythm */
@media (max-width: 900px) {
    .social-page .social-table-container,
    .public-portfolio-page .public-holdings-container {
        border: 1px solid rgba(92, 116, 147, 0.36) !important;
        border-radius: 12px !important;
        background: rgba(8, 14, 26, 0.42) !important;
        overflow: hidden;
    }

    .social-page .social-table tr,
    .public-portfolio-page .public-holdings-table tr {
        margin: 0 !important;
        border: 0 !important;
        border-bottom: 1px solid rgba(92, 116, 147, 0.3) !important;
        border-radius: 0 !important;
        background: transparent !important;
    }

    .social-page .social-table tr:last-child,
    .public-portfolio-page .public-holdings-table tr:last-child {
        border-bottom: 0 !important;
    }

    .social-page .social-table td,
    .public-portfolio-page .public-holdings-table td {
        padding: 0.58rem 0.68rem !important;
        gap: 0.14rem 0.62rem !important;
        border-bottom: 1px solid rgba(92, 116, 147, 0.16) !important;
        background: transparent !important;
        font-size: 0.89rem !important;
    }

    .social-page .social-table td:last-child,
    .public-portfolio-page .public-holdings-table td:last-child {
        border-bottom: 0 !important;
    }

    .social-page .social-table td::before,
    .public-portfolio-page .public-holdings-table td::before {
        font-size: 0.66rem !important;
        color: #c5d7eb !important;
        letter-spacing: 0.05em;
    }

    .social-page .portfolio-risk-label,
    .public-portfolio-page .holding-name {
        font-size: 0.75rem !important;
        line-height: 1.35 !important;
        color: #c1d4ea !important;
    }

    .public-portfolio-page .public-holdings-table td strong,
    .social-page .social-table td:first-child strong {
        font-size: 0.97rem;
    }

    .social-page .social-actions {
        display: grid !important;
        grid-template-columns: 1fr !important;
        gap: 0.36rem !important;
        width: 100%;
    }

    .social-page .action-link,
    .social-page .social-follow-form .social-follow-btn,
    .public-portfolio-page .public-follow-form .btn-primary,
    .public-portfolio-page .public-portfolio-head > .btn-primary {
        min-height: 42px;
        font-size: 0.79rem;
        font-weight: 700;
        border-radius: 9px;
    }
}

@media (max-width: 430px) {
    .social-page .social-table td,
    .public-portfolio-page .public-holdings-table td {
        padding: 0.54rem 0.6rem !important;
        font-size: 0.85rem !important;
    }

    .social-page .social-table td::before,
    .public-portfolio-page .public-holdings-table td::before {
        font-size: 0.63rem !important;
    }

    .social-page .action-link,
    .social-page .social-follow-form .social-follow-btn,
    .public-portfolio-page .public-follow-form .btn-primary,
    .public-portfolio-page .public-portfolio-head > .btn-primary {
        min-height: 40px;
        font-size: 0.74rem;
    }
}

/* Final stock detail pass: mobile hierarchy aligned with portfolio readability */
@media (max-width: 900px) {
    .stock-detail-page .directory-header.stock-detail-header {
        padding: 1.02rem 0 0.62rem;
        margin-bottom: 0.2rem;
        border-bottom: 1px solid rgba(92, 116, 147, 0.24);
    }

    .stock-detail-page .stock-detail-header h1 {
        font-size: clamp(1.32rem, 6vw, 1.7rem);
        line-height: 1.22;
        margin-bottom: 0.2rem;
    }

    .stock-detail-page .stock-detail-header .subtitle {
        margin-top: 0.3rem;
        font-size: 0.92rem;
        line-height: 1.42;
        color: #d7e4f4;
    }

    .stock-detail-page .stock-quote-line {
        display: grid;
        grid-template-columns: 1fr auto;
        gap: 0.26rem 0.52rem;
        margin-top: 0.32rem;
        align-items: baseline;
    }

    .stock-detail-page .quote-price {
        font-size: 1.46rem;
        line-height: 1.14;
    }

    .stock-detail-page .quote-change {
        font-size: 0.9rem;
        font-weight: 800;
        text-align: right;
    }

    .stock-detail-page .quote-meta {
        grid-column: 1 / -1;
        font-size: 0.75rem;
        color: #bfd2e8;
    }

    .stock-detail-page .stock-trust-stats {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 0.46rem;
        margin-top: 0.62rem;
    }

    .stock-detail-page .stock-trust-stats .t-stat {
        min-height: 54px;
        border-radius: 10px;
        padding: 0.44rem 0.58rem;
    }

    .stock-detail-page .stock-trust-stats .t-stat span {
        font-size: 0.98rem;
        line-height: 1.15;
    }

    .stock-detail-page .stock-insights-grid {
        gap: 0.66rem;
        margin: 0.72rem 0 0.92rem;
    }

    .stock-detail-page .stock-insight-card {
        border-radius: 10px;
        padding: 0.8rem;
        border: 1px solid rgba(92, 116, 147, 0.4);
        background: rgba(8, 14, 26, 0.54);
    }

    .stock-detail-page .stock-insight-card h2 {
        font-size: 0.9rem;
        margin-bottom: 0.54rem;
    }

    .stock-detail-page .insight-meta {
        margin: 0.14rem 0 0.52rem;
        font-size: 0.74rem;
        color: #c3d5ea;
    }

    .stock-detail-page .insight-kv {
        padding: 0.38rem 0;
        font-size: 0.82rem;
        gap: 0.58rem;
    }

    .stock-detail-page .score-matrix {
        gap: 0.36rem;
    }

    .stock-detail-page .score-head {
        font-size: 0.64rem;
    }

    .stock-detail-page .score-label {
        font-size: 0.76rem;
    }

    .stock-detail-page .score-cell {
        border-radius: 7px;
        padding: 0.36rem 0.32rem;
        font-size: 0.78rem;
    }

    .stock-detail-page .dividend-metrics {
        grid-template-columns: 1fr 1fr;
        gap: 0.38rem;
    }

    .stock-detail-page .dividend-summary-grid {
        grid-template-columns: 1fr;
        gap: 0.38rem;
    }

    .stock-detail-page .metric-box {
        padding: 0.44rem;
    }

    .stock-detail-page .metric-box span {
        font-size: 0.68rem;
    }

    .stock-detail-page .metric-box strong {
        font-size: 0.86rem;
    }

    .stock-detail-page .projection-grid {
        gap: 0.44rem;
    }

    .stock-detail-page .projection-row {
        padding: 0.46rem 0.56rem;
        border-radius: 8px;
        grid-template-columns: 1fr auto;
        gap: 0.16rem 0.58rem;
    }

    .stock-detail-page .projection-label {
        font-size: 0.74rem;
    }

    .stock-detail-page .projection-price {
        font-size: 0.84rem;
    }

    .stock-detail-page .projection-meta,
    .stock-detail-page .projection-range {
        grid-column: 1 / -1;
        text-align: left;
        font-size: 0.7rem;
    }

    .stock-detail-page .stock-detail-actions {
        gap: 0.52rem;
        margin-bottom: 0.96rem;
    }

    .stock-detail-page .stock-detail-actions .btn-primary,
    .stock-detail-page .stock-detail-actions .btn-secondary {
        width: 100%;
        min-width: 0;
        min-height: 44px;
        font-size: 0.9rem;
    }

    .stock-detail-page .related-sector-section {
        margin-top: 0.98rem;
        padding-top: 0.86rem;
    }

    .stock-detail-page .related-sector-title {
        margin: 0 0 0.58rem;
        font-size: 0.92rem;
        color: #d5e3f3;
    }

    .stock-detail-page .related-stock-grid {
        grid-template-columns: 1fr;
        gap: 0.5rem;
    }

    .stock-detail-page .related-stock-grid .stock-card {
        border-radius: 10px;
        border-color: rgba(92, 116, 147, 0.36);
        background: rgba(8, 14, 26, 0.5);
    }
}

@media (max-width: 430px) {
    .stock-detail-page .stock-detail-header h1 {
        font-size: clamp(1.2rem, 6.2vw, 1.48rem);
    }

    .stock-detail-page .stock-detail-header .subtitle {
        font-size: 0.88rem;
    }

    .stock-detail-page .quote-price {
        font-size: 1.32rem;
    }

    .stock-detail-page .quote-change {
        font-size: 0.84rem;
    }

    .stock-detail-page .score-matrix {
        grid-template-columns: 1fr 1fr;
    }

    .stock-detail-page .score-head {
        font-size: 0.62rem;
    }

    .stock-detail-page .dividend-metrics {
        grid-template-columns: 1fr;
    }

    .stock-detail-page .projection-row {
        grid-template-columns: 1fr;
    }

    .stock-detail-page .projection-price {
        text-align: left;
    }
}

/* Final desktop pass: market + companies professional hierarchy */
@media (min-width: 901px) {
    .market-directory-page .directory-header,
    .companies-page .directory-header {
        max-width: 1160px;
        margin: 0 auto;
        padding: 2.2rem 0 1rem;
    }

    .market-directory-page .directory-header h1,
    .companies-page .directory-header h1 {
        font-size: clamp(1.82rem, 2.25vw, 2.3rem);
        line-height: 1.16;
        letter-spacing: -0.02em;
        background: linear-gradient(125deg, var(--text-primary) 25%, #8eccf5 100%);
        -webkit-background-clip: text;
        -webkit-text-fill-color: transparent;
        color: transparent;
    }

    .market-directory-page .directory-header .subtitle,
    .companies-page .directory-header .subtitle {
        margin-top: 0.3rem;
        margin-bottom: 0.52rem;
        max-width: 74ch;
        font-size: 0.97rem;
        line-height: 1.5;
        color: #d4e1f2;
    }

    .market-directory-page .directory-meta,
    .companies-page .directory-meta {
        display: inline-flex;
        align-items: center;
        border: 1px solid rgba(92, 116, 147, 0.45);
        border-radius: 999px;
        padding: 0.22rem 0.62rem;
        margin: 0 0 0.7rem;
        font-size: 0.78rem;
        color: #c6d8ed;
        background: rgba(255, 255, 255, 0.02);
    }

    .market-directory-page .market-search,
    .companies-page .market-search {
        width: min(620px, 62vw);
        min-height: 44px;
        border-color: rgba(92, 116, 147, 0.55);
        background: rgba(8, 14, 26, 0.62);
        font-size: 0.92rem;
        margin-bottom: 0.78rem;
        transition: border-color 0.15s ease, box-shadow 0.15s ease;
    }

    .market-directory-page .market-search:focus,
    .companies-page .market-search:focus {
        outline: none;
        border-color: rgba(57, 194, 255, 0.55);
        box-shadow: 0 0 0 3px rgba(57, 194, 255, 0.12);
    }

    .companies-page .letter-filter {
        margin-top: 0.72rem;
        gap: 0.42rem;
    }

    .companies-page .letter-chip {
        min-height: 34px;
        min-width: 34px;
        padding: 0 0.6rem;
        border-color: rgba(92, 116, 147, 0.56);
        background: rgba(255, 255, 255, 0.02);
        font-size: 0.74rem;
    }

    .companies-page .letter-chip.active {
        background: #eaf3ff;
        border-color: #eaf3ff;
        color: #071120;
    }

    .market-directory-page .table-container,
    .companies-page .table-container {
        max-width: 1160px;
        margin: 0 auto 1.4rem;
        border: 1px solid rgba(92, 116, 147, 0.36);
        border-radius: 14px;
        background: rgba(8, 14, 26, 0.44);
        overflow: hidden;
    }

    .market-directory-page .market-table,
    .companies-page .market-table {
        font-size: 0.9rem;
    }

    .market-directory-page .market-table thead th,
    .companies-page .market-table thead th {
        position: sticky;
        top: 0;
        z-index: 1;
        padding: 0.78rem 0.9rem;
        border-bottom: 1px solid rgba(92, 116, 147, 0.42);
        background: linear-gradient(180deg, rgba(13, 23, 40, 0.97), rgba(10, 18, 32, 0.96));
        color: #c2d4ea;
        font-size: 0.7rem;
        text-transform: uppercase;
        letter-spacing: 0.08em;
        font-weight: 700;
    }

    .market-directory-page .market-table td,
    .companies-page .market-table td {
        padding: 0.82rem 0.9rem;
        border-bottom: 1px solid rgba(92, 116, 147, 0.24);
        color: #dbe7f7;
        vertical-align: middle;
    }

    .market-directory-page .market-table tbody tr:last-child td,
    .companies-page .market-table tbody tr:last-child td {
        border-bottom: 0;
    }

    .market-directory-page .market-table tbody tr,
    .companies-page .market-table tbody tr {
        transition: background 0.12s ease;
    }

    .market-directory-page .market-table tbody tr:hover,
    .companies-page .market-table tbody tr:hover {
        background: rgba(57, 194, 255, 0.06);
    }

    .market-directory-page .market-table td.ticker-cell strong,
    .companies-page .market-table td:first-child strong {
        font-size: 0.95rem;
        color: #eef5ff;
        letter-spacing: 0.01em;
    }

    .market-directory-page .market-table td.market-cell-score .cell-value.buy { color: var(--accent-buy); font-weight: 800; }
    .market-directory-page .market-table td.market-cell-score .cell-value.sell { color: var(--accent-sell); font-weight: 800; }
    .market-directory-page .market-table td.market-cell-score .cell-value.hold { color: var(--text-secondary); }

    .market-directory-page .market-table td.ticker-cell a.link-clean:hover {
        color: #8eccf5;
        text-decoration: underline;
        text-underline-offset: 3px;
    }

    .market-directory-page .market-table td.name-cell .company-name,
    .companies-page .market-table td:nth-child(2) {
        color: #d4e2f3;
        line-height: 1.4;
    }

    .market-directory-page .market-table td.text-right,
    .companies-page .market-table td.text-right {
        font-variant-numeric: tabular-nums;
        font-weight: 700;
    }

    .market-directory-page .market-table .badge-mini {
        font-size: 0.71rem;
        padding: 0.2rem 0.52rem;
        letter-spacing: 0.04em;
    }

    .market-directory-page .blur-row td {
        background: rgba(8, 14, 26, 0.74);
    }

    .market-directory-page .table-cta a {
        min-height: 40px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        border-radius: 10px;
        padding: 0.48rem 0.88rem;
        font-weight: 700;
    }
}

/* Final desktop pass: social + public portfolio professional hierarchy */
@media (min-width: 901px) {
    .social-page .directory-header {
        max-width: 1160px;
        margin: 0 auto;
        padding: 2.2rem 0 1rem;
    }

    .social-page .directory-header h1 {
        font-size: clamp(1.82rem, 2.25vw, 2.3rem);
        line-height: 1.16;
        letter-spacing: -0.02em;
    }

    .social-page .directory-header .subtitle {
        margin-top: 0.3rem;
        margin-bottom: 0.6rem;
        max-width: 74ch;
        font-size: 0.97rem;
        line-height: 1.5;
        color: #d4e1f2;
    }

    .social-page .social-guest-cta {
        margin-top: 0.36rem;
    }

    .social-page .social-guest-cta .btn-primary {
        min-height: 42px;
        padding: 0.56rem 0.98rem;
        font-size: 0.84rem;
    }

    .social-page .social-table-container {
        max-width: 1160px;
        margin: 0 auto 1.4rem;
        border: 1px solid rgba(92, 116, 147, 0.36);
        border-radius: 14px;
        background: rgba(8, 14, 26, 0.44);
        overflow: hidden;
    }

    .social-page .social-table {
        font-size: 0.9rem;
    }

    .social-page .social-table thead th {
        position: sticky;
        top: 0;
        z-index: 1;
        padding: 0.78rem 0.9rem;
        border-bottom: 1px solid rgba(92, 116, 147, 0.42);
        background: linear-gradient(180deg, rgba(13, 23, 40, 0.97), rgba(10, 18, 32, 0.96));
        color: #c2d4ea;
        font-size: 0.7rem;
        text-transform: uppercase;
        letter-spacing: 0.08em;
        font-weight: 700;
    }

    .social-page .social-table td {
        padding: 0.82rem 0.9rem;
        border-bottom: 1px solid rgba(92, 116, 147, 0.24);
        color: #dbe7f7;
        vertical-align: middle;
    }

    .social-page .social-table tbody tr:last-child td {
        border-bottom: 0;
    }

    .social-page .social-table tbody tr:hover {
        background: rgba(56, 189, 248, 0.08);
    }

    .social-page .social-table td:first-child strong {
        font-size: 0.95rem;
        color: #eef5ff;
    }

    .social-page .social-table td.small-caps {
        color: #d4e2f3;
        letter-spacing: 0.01em;
    }

    .social-page .social-table td.text-right {
        font-variant-numeric: tabular-nums;
        font-weight: 700;
    }

    .social-page .portfolio-risk-label {
        margin-top: 0.16rem;
        font-size: 0.73rem;
        color: #c1d4ea;
    }

    .social-page .social-actions {
        justify-content: flex-end;
        gap: 0.38rem;
    }

    .social-page .action-link,
    .social-page .social-follow-btn {
        min-height: 34px;
        padding: 0.28rem 0.62rem;
        border-radius: 8px;
        font-size: 0.72rem;
        font-weight: 700;
        letter-spacing: 0.02em;
    }

    .social-page .action-link {
        background: rgba(255, 255, 255, 0.02);
        border-color: rgba(92, 116, 147, 0.48);
    }

    .social-page .social-follow-btn {
        border: 1px solid rgba(16, 185, 129, 0.5);
        background: rgba(16, 185, 129, 0.14);
        color: #d1fae5;
    }
}

/* Final consistency sweep: cleaner hierarchy, lighter landing, clearer mobile nav */
@media (min-width: 901px) {
    .home-page.home-v2 {
        max-width: 1180px;
        padding-top: 2.1rem;
        padding-bottom: 2.35rem;
    }

    .home-v2-hero {
        gap: 1.85rem;
        border-radius: 20px;
        border-color: rgba(88, 112, 143, 0.5);
        box-shadow: 0 18px 36px rgba(0, 0, 0, 0.28);
    }

    .home-v2-preview {
        border-radius: 14px;
        border-color: rgba(88, 112, 143, 0.5);
        background: linear-gradient(180deg, rgba(10, 18, 33, 0.76), rgba(8, 14, 26, 0.84));
    }

    .home-v2-proof {
        margin-top: 1.22rem;
        padding: 0.72rem 0;
        gap: 1rem;
        border-top: 1px solid rgba(102, 126, 157, 0.28);
        border-bottom: 1px solid rgba(102, 126, 157, 0.28);
    }

    .home-v2-proof-item {
        border-right: 0;
        padding: 0.06rem 0;
    }

    .home-v2-proof-item + .home-v2-proof-item {
        border-left: 1px solid rgba(102, 126, 157, 0.22);
        padding-left: 1rem;
    }

    .home-v2-sections {
        gap: 1.95rem;
        margin-top: 1.32rem;
    }

    .home-v2-block {
        border-top: 0;
        padding-top: 0;
    }

    .home-v2-block h2 {
        font-size: 1.03rem;
        margin-bottom: 0.62rem;
        letter-spacing: 0.02em;
    }

    .home-v2-list-item,
    .home-v2-step {
        border: 0;
        padding: 0.58rem 0;
    }

    .home-v2-list-item + .home-v2-list-item,
    .home-v2-step + .home-v2-step {
        border-top: 1px solid rgba(102, 126, 157, 0.24);
    }

    .home-v2-step-index {
        width: 1.55rem;
        height: 1.55rem;
        font-size: 0.72rem;
        margin-top: 0.08rem;
    }

    .market-directory-page .directory-header,
    .companies-page .directory-header,
    .social-page .directory-header,
    .public-portfolio-page .directory-header {
        max-width: 1160px;
        padding: 2rem 0 0.9rem;
    }

    .market-directory-page .directory-header h1,
    .companies-page .directory-header h1,
    .social-page .directory-header h1,
    .public-portfolio-page .directory-header h1 {
        font-size: clamp(1.82rem, 2.2vw, 2.3rem);
        line-height: 1.14;
    }

    .market-directory-page .directory-header .subtitle,
    .companies-page .directory-header .subtitle,
    .social-page .directory-header .subtitle,
    .public-portfolio-page .directory-header .subtitle {
        margin-top: 0.3rem;
        margin-bottom: 0.62rem;
        max-width: 74ch;
        font-size: 0.97rem;
        line-height: 1.5;
        color: #d5e3f3;
    }
}

@media (max-width: 900px) {
    .container {
        padding: 0 0.95rem;
    }

    .header-inner {
        min-height: 64px;
        padding: 0 0.8rem;
    }

    .logo {
        font-size: 1.02rem;
    }

    .mobile-top-actions {
        gap: 0.34rem;
        margin-right: 0.24rem;
    }

    .mobile-auth-shortcut {
        min-height: 38px;
        min-width: 70px;
        padding: 0.34rem 0.58rem;
        border-radius: 999px;
        font-size: 0.72rem;
        font-weight: 800;
        border-width: 1px;
    }

    .mobile-menu-toggle {
        padding: 0.36rem 0.34rem;
        border: 1px solid rgba(96, 122, 156, 0.5);
        border-radius: 10px;
        background: rgba(255, 255, 255, 0.02);
    }

    .mobile-menu-toggle .bar {
        width: 20px;
        margin: 4px 0;
        background: #e8f2ff;
    }

    .main-nav {
        width: min(90vw, 360px);
        padding: calc(0.64rem + env(safe-area-inset-top)) 0.82rem 0.92rem;
    }

    .nav-mobile-head {
        padding-bottom: 0.62rem;
    }

    .nav-mobile-auth {
        margin-top: 0.2rem;
        padding-bottom: 0.68rem;
        margin-bottom: 0.42rem;
        gap: 0.42rem;
    }

    .nav-mobile-auth .nav-mobile-auth-btn {
        min-height: 42px;
        border-radius: 10px;
        font-size: 0.88rem;
    }

    .nav-mobile-section-label {
        font-size: 0.64rem;
        letter-spacing: 0.1em;
        color: #a8bdd7;
    }

    .nav-link {
        padding: 0.72rem 0.68rem;
        border-radius: 10px;
    }

    .nav-link-text {
        font-size: 0.9rem;
        font-weight: 700;
    }

    .nav-utils {
        margin-top: 0.5rem;
        padding-top: 0.62rem;
        gap: 0.65rem;
    }

    .market-directory-page .directory-header,
    .companies-page .directory-header,
    .social-page .directory-header,
    .public-portfolio-page .directory-header,
    .stock-detail-page .directory-header {
        padding: 1rem 0 0.56rem;
        margin-bottom: 0.14rem;
    }

    .market-directory-page .directory-header h1,
    .companies-page .directory-header h1,
    .social-page .directory-header h1,
    .public-portfolio-page .directory-header h1,
    .stock-detail-page .directory-header h1 {
        font-size: clamp(1.3rem, 6vw, 1.66rem);
        line-height: 1.22;
    }

    .market-directory-page .directory-header .subtitle,
    .companies-page .directory-header .subtitle,
    .social-page .directory-header .subtitle,
    .public-portfolio-page .directory-header .subtitle,
    .stock-detail-page .directory-header .subtitle {
        margin-top: 0.22rem;
        margin-bottom: 0.5rem;
        font-size: 0.9rem;
        line-height: 1.43;
        color: #d5e3f4;
    }

    .market-directory-page .table-container,
    .companies-page .table-container,
    .social-page .social-table-container,
    .public-portfolio-page .public-holdings-container,
    .portfolio-page .holdings-container {
        border: 1px solid rgba(92, 116, 147, 0.36) !important;
        border-radius: 12px !important;
        background: rgba(8, 14, 26, 0.42) !important;
        overflow: hidden;
    }

    .market-directory-page .market-table td::before,
    .companies-page .market-table td::before,
    .social-page .social-table td::before,
    .public-portfolio-page .public-holdings-table td::before,
    .portfolio-page .holdings-table td::before {
        font-size: 0.64rem !important;
        letter-spacing: 0.06em;
        color: #c4d6eb !important;
    }

    .home-page.home-v2 {
        padding-top: 0.84rem;
        padding-bottom: 1.22rem;
    }

    .home-v2-hero {
        border-radius: 12px;
        border-color: rgba(94, 118, 150, 0.44);
        box-shadow: none;
        padding: 0.92rem;
        gap: 0.72rem;
    }

    .home-v2-copy h1 {
        font-size: clamp(1.56rem, 7.2vw, 1.96rem);
        line-height: 1.14;
    }

    .home-v2-subtitle {
        font-size: 0.94rem;
        line-height: 1.46;
    }

    .home-v2-note {
        margin: 0.44rem 0 0.72rem;
        font-size: 0.84rem;
    }

    .home-v2-links a {
        border: 1px solid rgba(98, 123, 156, 0.48);
        border-radius: 9px;
        padding: 0.42rem 0.58rem;
        background: rgba(9, 18, 33, 0.5);
    }

    .home-v2-preview {
        border-top: 1px solid rgba(104, 129, 160, 0.34);
        margin-top: 0.08rem;
    }

    .home-v2-preview-row {
        padding: 0.52rem 0;
    }

    .home-v2-preview-row:nth-child(n+3),
    .home-v2-proof,
    .home-v2-sections,
    .home-v2-final {
        display: none;
    }
}

@media (max-width: 430px) {
    .container {
        padding: 0 0.82rem;
    }

    .mobile-auth-shortcut {
        min-height: 34px;
        min-width: 64px;
        padding: 0.26rem 0.46rem;
        font-size: 0.67rem;
    }

    .mobile-menu-toggle {
        padding: 0.3rem 0.28rem;
        border-radius: 9px;
    }

    .main-nav {
        width: min(92vw, 336px);
        padding: calc(0.58rem + env(safe-area-inset-top)) 0.74rem 0.84rem;
    }

    .nav-link {
        padding: 0.66rem 0.62rem;
    }

    .nav-link-text {
        font-size: 0.86rem;
    }

    .home-v2-copy h1 {
        font-size: clamp(1.42rem, 8vw, 1.78rem);
    }

    .home-v2-subtitle {
        font-size: 0.89rem;
    }

    .home-v2-note {
        font-size: 0.81rem;
    }
}

/* Final index conversion pass: simpler first-fold and clearer desktop CTA flow */
@media (min-width: 901px) {
    .home-page.home-v2 {
        padding-top: 1.9rem;
        padding-bottom: 2.25rem;
    }

    .home-v2-hero {
        grid-template-columns: minmax(0, 1.34fr) minmax(0, 0.66fr);
        gap: 1.95rem;
        border-radius: 18px;
        padding: 1.86rem;
        border-color: rgba(88, 112, 143, 0.44);
        box-shadow: 0 16px 32px rgba(0, 0, 0, 0.26);
    }

    .home-v2-copy h1 {
        max-width: 18ch;
        font-size: clamp(2.24rem, 4vw, 2.98rem);
        line-height: 1.08;
        margin-bottom: 0.72rem;
    }

    .home-v2-subtitle {
        max-width: 58ch;
        font-size: 1.03rem;
        line-height: 1.52;
    }

    .home-v2-note {
        margin: 0.56rem 0 0.88rem;
        max-width: 60ch;
        font-size: 0.9rem;
    }

    .home-v2-search {
        max-width: 620px;
    }

    .home-v2-copy > .home-v2-actions {
        display: none;
    }

    .home-v2-links {
        margin-top: 0.62rem;
        gap: 0.7rem;
    }

    .home-v2-links a {
        font-size: 0.8rem;
        letter-spacing: 0.01em;
    }

    .home-v2-preview {
        border-radius: 14px;
        padding: 0.92rem 0.95rem;
        border-color: rgba(88, 112, 143, 0.42);
        background: linear-gradient(180deg, rgba(10, 18, 33, 0.72), rgba(8, 14, 26, 0.83));
    }

    .home-v2-preview-head p {
        margin: 0.24rem 0 0.56rem;
    }

    .home-v2-preview-row {
        padding: 0.56rem 0;
    }

    .home-v2-conversion {
        margin: 0.88rem 0 0.42rem;
        padding: 0.72rem 0;
        border-top: 1px solid rgba(98, 123, 156, 0.34);
        border-bottom: 1px solid rgba(98, 123, 156, 0.34);
        display: grid;
        grid-template-columns: minmax(0, 1.1fr) auto auto;
        gap: 1rem;
        align-items: center;
    }

    .home-v2-conversion-copy h2 {
        margin: 0;
        font-size: 1.04rem;
        letter-spacing: 0.01em;
        color: #e8f2ff;
    }

    .home-v2-conversion-copy p {
        margin: 0.2rem 0 0;
        font-size: 0.84rem;
        line-height: 1.45;
        color: #c8d9ee;
        max-width: 58ch;
    }

    .home-v2-conversion-metrics {
        display: inline-flex;
        align-items: center;
        gap: 0.72rem;
    }

    .home-v2-conversion-metric {
        min-width: 104px;
        display: flex;
        flex-direction: column;
        gap: 0.06rem;
        padding-left: 0.72rem;
        border-left: 1px solid rgba(98, 123, 156, 0.26);
    }

    .home-v2-conversion-metric:first-child {
        border-left: 0;
        padding-left: 0;
    }

    .home-v2-conversion-value {
        font-size: 1.04rem;
        font-weight: 800;
        color: #eef5ff;
        line-height: 1.14;
    }

    .home-v2-conversion-label {
        font-size: 0.72rem;
        color: #bfd1e8;
        letter-spacing: 0.02em;
    }

    .home-v2-actions.home-v2-actions-final {
        margin-top: 0;
        margin-left: auto;
        gap: 0.5rem;
        justify-content: flex-end;
        flex-wrap: nowrap;
    }

    .home-v2-actions.home-v2-actions-final .btn-primary,
    .home-v2-actions.home-v2-actions-final .btn-secondary {
        min-width: 166px;
        min-height: 42px;
        font-size: 0.82rem;
    }

    .home-v2-sections {
        margin-top: 0.9rem;
        gap: 1.7rem;
    }

    .home-v2-block h2 {
        font-size: 1.01rem;
        margin-bottom: 0.54rem;
    }

    .home-v2-list-item h3,
    .home-v2-step h3 {
        font-size: 0.9rem;
    }

    .home-v2-list-item p,
    .home-v2-step p {
        font-size: 0.82rem;
        line-height: 1.46;
    }
}

@media (max-width: 900px) {
    .home-v2-conversion {
        display: none;
    }
}

/* Market + social conversion strip: cleaner page entry and stronger CTA */
@media (min-width: 901px) {
    .market-directory-page .entry-conversion,
    .social-page .entry-conversion,
    .companies-page .entry-conversion {
        max-width: 1160px;
        margin: 0 auto 0.82rem;
        padding: 0.68rem 0.04rem;
        border-top: 1px solid rgba(98, 123, 156, 0.32);
        border-bottom: 1px solid rgba(98, 123, 156, 0.32);
        display: grid;
        grid-template-columns: minmax(0, 1.14fr) auto auto;
        align-items: center;
        gap: 0.84rem;
    }

    .market-directory-page .entry-conversion-copy h2,
    .social-page .entry-conversion-copy h2,
    .companies-page .entry-conversion-copy h2 {
        margin: 0;
        font-size: 0.96rem;
        letter-spacing: 0.01em;
        color: #e8f2ff;
    }

    .market-directory-page .entry-conversion-copy p,
    .social-page .entry-conversion-copy p,
    .companies-page .entry-conversion-copy p {
        margin: 0.2rem 0 0;
        font-size: 0.8rem;
        line-height: 1.45;
        color: #c6d8ee;
        max-width: 64ch;
    }

    .market-directory-page .entry-conversion-metrics,
    .social-page .entry-conversion-metrics,
    .companies-page .entry-conversion-metrics {
        display: inline-flex;
        align-items: center;
        gap: 0.5rem;
    }

    .market-directory-page .entry-conversion-metric,
    .social-page .entry-conversion-metric,
    .companies-page .entry-conversion-metric {
        min-width: 96px;
        display: flex;
        flex-direction: column;
        gap: 0.08rem;
        padding-left: 0.5rem;
        border-left: 1px solid rgba(98, 123, 156, 0.24);
    }

    .market-directory-page .entry-conversion-metric:first-child,
    .social-page .entry-conversion-metric:first-child,
    .companies-page .entry-conversion-metric:first-child {
        padding-left: 0;
        border-left: 0;
    }

    .market-directory-page .entry-conversion-value,
    .social-page .entry-conversion-value,
    .companies-page .entry-conversion-value {
        font-size: 0.98rem;
        line-height: 1.16;
        font-weight: 800;
        color: #eef5ff;
    }

    .market-directory-page .entry-conversion-label,
    .social-page .entry-conversion-label,
    .companies-page .entry-conversion-label {
        font-size: 0.68rem;
        line-height: 1.22;
        color: #bdd1e8;
    }

    .market-directory-page .entry-conversion-actions,
    .social-page .entry-conversion-actions,
    .companies-page .entry-conversion-actions {
        margin-left: auto;
        display: inline-flex;
        align-items: center;
        gap: 0.46rem;
    }

    .market-directory-page .entry-conversion-actions .btn-primary,
    .market-directory-page .entry-conversion-actions .btn-secondary,
    .social-page .entry-conversion-actions .btn-primary,
    .social-page .entry-conversion-actions .btn-secondary,
    .companies-page .entry-conversion-actions .btn-primary,
    .companies-page .entry-conversion-actions .btn-secondary {
        min-width: 154px;
        min-height: 40px;
        font-size: 0.79rem;
    }
}

@media (max-width: 900px) {
    .market-directory-page .entry-conversion,
    .social-page .entry-conversion,
    .companies-page .entry-conversion {
        margin: 0.26rem 0 0.62rem;
        padding: 0.66rem;
        border: 1px solid rgba(92, 116, 147, 0.34);
        border-radius: 11px;
        background: rgba(8, 14, 26, 0.4);
    }

    .market-directory-page .entry-conversion-copy h2,
    .social-page .entry-conversion-copy h2,
    .companies-page .entry-conversion-copy h2 {
        margin: 0;
        font-size: 0.88rem;
    }

    .market-directory-page .entry-conversion-copy p,
    .social-page .entry-conversion-copy p,
    .companies-page .entry-conversion-copy p {
        margin: 0.22rem 0 0;
        font-size: 0.82rem;
        line-height: 1.43;
        color: #c7d9ee;
    }

    .market-directory-page .entry-conversion-metrics,
    .social-page .entry-conversion-metrics,
    .companies-page .entry-conversion-metrics {
        margin-top: 0.52rem;
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 0.4rem;
    }

    .social-page .entry-conversion-metrics,
    .companies-page .entry-conversion-metrics {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .market-directory-page .entry-conversion-metric,
    .social-page .entry-conversion-metric,
    .companies-page .entry-conversion-metric {
        border: 1px solid rgba(92, 116, 147, 0.34);
        border-radius: 9px;
        background: rgba(255, 255, 255, 0.02);
        padding: 0.4rem 0.45rem;
        display: flex;
        flex-direction: column;
        gap: 0.08rem;
    }

    .market-directory-page .entry-conversion-value,
    .social-page .entry-conversion-value,
    .companies-page .entry-conversion-value {
        font-size: 0.9rem;
        font-weight: 800;
        color: #edf5ff;
    }

    .market-directory-page .entry-conversion-label,
    .social-page .entry-conversion-label,
    .companies-page .entry-conversion-label {
        font-size: 0.66rem;
        line-height: 1.22;
        color: #bfd2e8;
    }

    .market-directory-page .entry-conversion-actions,
    .social-page .entry-conversion-actions,
    .companies-page .entry-conversion-actions {
        margin-top: 0.52rem;
        display: grid;
        grid-template-columns: 1fr;
        gap: 0.42rem;
    }

    .market-directory-page .entry-conversion-actions .btn-primary,
    .market-directory-page .entry-conversion-actions .btn-secondary,
    .social-page .entry-conversion-actions .btn-primary,
    .social-page .entry-conversion-actions .btn-secondary,
    .companies-page .entry-conversion-actions .btn-primary,
    .companies-page .entry-conversion-actions .btn-secondary {
        width: 100%;
        min-height: 42px;
        font-size: 0.84rem;
        text-align: center;
    }
}

@media (max-width: 430px) {
    .market-directory-page .entry-conversion,
    .social-page .entry-conversion,
    .companies-page .entry-conversion {
        padding: 0.58rem;
    }

    .market-directory-page .entry-conversion-copy h2,
    .social-page .entry-conversion-copy h2,
    .companies-page .entry-conversion-copy h2 {
        font-size: 0.84rem;
    }

    .market-directory-page .entry-conversion-copy p,
    .social-page .entry-conversion-copy p,
    .companies-page .entry-conversion-copy p {
        font-size: 0.78rem;
    }

    .market-directory-page .entry-conversion-actions .btn-primary,
    .market-directory-page .entry-conversion-actions .btn-secondary,
    .social-page .entry-conversion-actions .btn-primary,
    .social-page .entry-conversion-actions .btn-secondary,
    .companies-page .entry-conversion-actions .btn-primary,
    .companies-page .entry-conversion-actions .btn-secondary {
        min-height: 40px;
        font-size: 0.8rem;
    }
}

/* Index overflow hotfix: keep forms and conversion strips inside viewport */
.search-box {
    box-sizing: border-box;
    max-width: min(100%, 560px);
}

.search-box input {
    min-width: 0;
}

.home-page.home-v2,
.home-page.home-v2 .home-v2-hero,
.home-page.home-v2 .home-v2-conversion,
.home-page.home-v2 .home-v2-search,
.home-page.home-v2 .home-v2-conversion-metrics,
.home-page.home-v2 .home-v2-actions.home-v2-actions-final {
    box-sizing: border-box;
    max-width: 100%;
}

.home-page.home-v2 .home-v2-copy,
.home-page.home-v2 .home-v2-preview,
.home-page.home-v2 .home-v2-conversion-copy,
.home-page.home-v2 .home-v2-conversion-metric {
    min-width: 0;
}

@media (min-width: 901px) and (max-width: 1240px) {
    .home-v2-conversion {
        grid-template-columns: 1fr;
        gap: 0.72rem;
    }

    .home-v2-conversion-metrics {
        display: grid;
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 0.44rem;
    }

    .home-v2-conversion-metric {
        min-width: 0;
        padding-left: 0.42rem;
    }

    .home-v2-actions.home-v2-actions-final {
        margin-left: 0;
        width: 100%;
        justify-content: flex-start;
        flex-wrap: wrap;
    }

    .market-directory-page .entry-conversion,
    .social-page .entry-conversion,
    .companies-page .entry-conversion {
        grid-template-columns: 1fr;
        gap: 0.7rem;
    }

    .market-directory-page .entry-conversion-metrics,
    .social-page .entry-conversion-metrics,
    .companies-page .entry-conversion-metrics {
        display: grid;
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 0.42rem;
    }

    .market-directory-page .entry-conversion-metric,
    .social-page .entry-conversion-metric,
    .companies-page .entry-conversion-metric {
        min-width: 0;
    }

    .market-directory-page .entry-conversion-actions,
    .social-page .entry-conversion-actions,
    .companies-page .entry-conversion-actions {
        margin-left: 0;
        width: 100%;
        justify-content: flex-start;
        flex-wrap: wrap;
    }
}

/* Hard desktop guard for index CTA overflow */
@media (min-width: 901px) {
    .home-page.home-v2 {
        overflow-x: clip;
    }

    .home-page.home-v2 .home-v2-conversion {
        grid-template-columns: 1fr;
        gap: 0.72rem;
    }

    .home-page.home-v2 .home-v2-conversion-metrics {
        width: 100%;
        display: grid;
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 0.42rem;
    }

    .home-page.home-v2 .home-v2-conversion-metric {
        min-width: 0;
        padding: 0.4rem 0.45rem;
        border-left: 0;
        border: 1px solid rgba(98, 123, 156, 0.24);
        border-radius: 9px;
        background: rgba(255, 255, 255, 0.02);
    }

    .home-page.home-v2 .home-v2-actions.home-v2-actions-final {
        margin-left: 0;
        width: 100%;
        justify-content: flex-start;
        flex-wrap: wrap;
    }

    .home-page.home-v2 .home-v2-actions.home-v2-actions-final .btn-primary,
    .home-page.home-v2 .home-v2-actions.home-v2-actions-final .btn-secondary {
        min-width: 0;
        max-width: 100%;
        flex: 0 1 auto;
    }
}

/* Final CTA fit fix: long Norwegian labels should never hit right edge */
.home-page.home-v2 .home-v2-actions.home-v2-actions-final,
.market-directory-page .entry-conversion-actions,
.social-page .entry-conversion-actions,
.companies-page .entry-conversion-actions {
    width: 100%;
    box-sizing: border-box;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 0.42rem;
    justify-items: stretch;
    padding: 0 0.08rem;
}

.home-page.home-v2 .home-v2-actions.home-v2-actions-final .btn-primary,
.home-page.home-v2 .home-v2-actions.home-v2-actions-final .btn-secondary,
.market-directory-page .entry-conversion-actions .btn-primary,
.market-directory-page .entry-conversion-actions .btn-secondary,
.social-page .entry-conversion-actions .btn-primary,
.social-page .entry-conversion-actions .btn-secondary,
.companies-page .entry-conversion-actions .btn-primary,
.companies-page .entry-conversion-actions .btn-secondary {
    width: 100%;
    min-width: 0;
    max-width: 100%;
    box-sizing: border-box;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.62rem 0.92rem;
    text-align: center;
    white-space: normal;
    overflow-wrap: anywhere;
    line-height: 1.25;
}

.home-page.home-v2 .home-v2-conversion,
.market-directory-page .entry-conversion,
.social-page .entry-conversion,
.companies-page .entry-conversion {
    overflow: hidden;
}

/* Mobile baseline reset: enforce professional, readable hierarchy across all pages */
@media (max-width: 900px) {
    :root {
        --text-secondary: #d5e2f2;
        --text-muted: #b0c2d9;
        --border-subtle: #344a67;
    }

    html {
        font-size: 16px;
    }

    body {
        line-height: 1.58;
        text-rendering: optimizeLegibility;
    }

    .container {
        padding-left: 0.95rem !important;
        padding-right: 0.95rem !important;
    }

    h1 {
        font-size: clamp(1.5rem, 6.4vw, 1.98rem) !important;
        line-height: 1.18 !important;
        letter-spacing: -0.02em !important;
    }

    h2 {
        font-size: clamp(1.12rem, 4.8vw, 1.38rem) !important;
        line-height: 1.24 !important;
    }

    h3 {
        font-size: clamp(1rem, 4.1vw, 1.16rem) !important;
        line-height: 1.3 !important;
    }

    p,
    .subtitle,
    .insight-meta,
    .home-v2-subtitle,
    .home-v2-note,
    .directory-meta,
    .entry-conversion-copy p,
    .public-portfolio-page .directory-header .subtitle,
    .stock-detail-page .directory-header .subtitle {
        font-size: 0.95rem !important;
        line-height: 1.56 !important;
    }

    .btn-primary,
    .btn-secondary,
    .btn-outline,
    .nav-btn,
    .mobile-cta-primary,
    .mobile-cta-secondary,
    .home-v2-actions .btn-primary,
    .home-v2-actions .btn-secondary,
    .entry-conversion-actions .btn-primary,
    .entry-conversion-actions .btn-secondary {
        min-height: 44px !important;
        padding: 0.64rem 0.95rem !important;
        font-size: 0.92rem !important;
        line-height: 1.24 !important;
        border-radius: 11px !important;
    }

    .header-inner {
        min-height: 66px !important;
        padding: 0 0.8rem !important;
    }

    .logo {
        font-size: 1.05rem !important;
        letter-spacing: -0.03em !important;
    }

    .mobile-top-actions {
        gap: 0.34rem !important;
        margin-right: 0.32rem !important;
    }

    .mobile-auth-shortcut,
    .mobile-lang-shortcut {
        min-height: 34px !important;
        padding: 0.34rem 0.62rem !important;
        font-size: 0.76rem !important;
        border-radius: 999px !important;
    }

    .mobile-auth-shortcut {
        min-width: 68px !important;
    }

    .mobile-lang-shortcut {
        min-width: 42px !important;
    }

    .mobile-menu-toggle {
        padding: 0.32rem !important;
    }

    .main-nav {
        width: min(86%, 360px) !important;
        padding: calc(0.72rem + env(safe-area-inset-top)) 0.88rem 1rem !important;
    }

    .nav-mobile-title {
        font-size: 0.7rem !important;
    }

    .nav-mobile-section-label {
        font-size: 0.68rem !important;
    }

    .nav-link {
        min-height: 42px !important;
        padding: 0.74rem 0.72rem !important;
        border-radius: 11px !important;
    }

    .nav-link-text {
        font-size: 0.93rem !important;
        line-height: 1.3 !important;
    }

    .market-table td,
    .portfolio-page .holdings-table td,
    .public-portfolio-page .public-holdings-table td,
    .social-page table td {
        font-size: 0.9rem !important;
        line-height: 1.45 !important;
    }

    .market-table td::before,
    .portfolio-page .holdings-table td::before,
    .public-portfolio-page .public-holdings-table td::before,
    .social-page table td::before {
        font-size: 0.66rem !important;
        letter-spacing: 0.06em !important;
        color: #9eb4cd !important;
    }

    .badge-mini,
    .portfolio-risk-label,
    .holding-name,
    .panel-eyebrow,
    .metric .label {
        font-size: 0.74rem !important;
    }

    .home-v2-hero,
    .home-v2-conversion,
    .entry-conversion,
    .portfolio-page .panel,
    .stock-insight-card,
    .chart-container,
    .table-container {
        border-radius: 12px !important;
    }
}

@media (max-width: 430px) {
    .container {
        padding-left: 0.72rem !important;
        padding-right: 0.72rem !important;
    }

    h1 {
        font-size: clamp(1.34rem, 7.6vw, 1.72rem) !important;
    }

    h2 {
        font-size: clamp(1.04rem, 5.6vw, 1.26rem) !important;
    }

    p,
    .subtitle,
    .insight-meta,
    .home-v2-subtitle,
    .home-v2-note,
    .directory-meta {
        font-size: 0.9rem !important;
    }

    .mobile-auth-shortcut,
    .mobile-lang-shortcut {
        font-size: 0.72rem !important;
    }

    .mobile-auth-shortcut {
        min-width: 62px !important;
    }

    .mobile-lang-shortcut {
        min-width: 40px !important;
    }

    .nav-link-text {
        font-size: 0.89rem !important;
    }

    .btn-primary,
    .btn-secondary,
    .entry-conversion-actions .btn-primary,
    .entry-conversion-actions .btn-secondary {
        font-size: 0.88rem !important;
    }

    .market-table td,
    .portfolio-page .holdings-table td,
    .public-portfolio-page .public-holdings-table td,
    .social-page table td {
        font-size: 0.86rem !important;
    }
}

/* Mobile overhaul v2: simplified hierarchy and spacing */
@media (max-width: 900px) {
    body {
        background-image: radial-gradient(circle at 50% -24%, #1b2c44 0%, #040b17 78%) !important;
    }

    .home-page.home-v2 .home-v2-hero,
    .home-page.home-v2 .home-v2-conversion,
    .home-page.home-v2 .home-v2-block,
    .market-directory-page .entry-conversion,
    .social-page .entry-conversion,
    .companies-page .entry-conversion,
    .portfolio-page .panel,
    .stocks-page .stock-insight-card,
    .table-container {
        background: rgba(14, 23, 39, 0.96) !important;
        border: 1px solid #385170 !important;
        box-shadow: 0 10px 22px rgba(0, 0, 0, 0.24) !important;
    }

    .home-page.home-v2 .home-v2-hero {
        padding: 0.95rem !important;
        gap: 0.78rem !important;
    }

    .home-page.home-v2 .home-v2-copy h1 {
        font-size: clamp(1.62rem, 7.2vw, 2.02rem) !important;
        line-height: 1.15 !important;
        letter-spacing: -0.018em !important;
        margin-bottom: 0.42rem !important;
    }

    .home-page.home-v2 .home-v2-subtitle,
    .home-page.home-v2 .home-v2-note {
        font-size: 0.98rem !important;
        line-height: 1.52 !important;
        color: #dce8f7 !important;
    }

    .home-page.home-v2 .home-v2-chip,
    .home-page.home-v2 .home-v2-links a,
    .home-page.home-v2 .home-v2-row-rank,
    .home-page.home-v2 .home-v2-row-score,
    .home-page.home-v2 .home-v2-proof-label,
    .entry-conversion-label,
    .panel-eyebrow,
    .portfolio-risk-label {
        font-size: 0.76rem !important;
    }

    .home-page.home-v2 .home-v2-preview-head h2,
    .home-page.home-v2 .home-v2-block h2,
    .entry-conversion-copy h2,
    .stocks-page .stock-insight-card h2 {
        font-size: 1.06rem !important;
        line-height: 1.25 !important;
    }

    .home-page.home-v2 .home-v2-preview-head p,
    .home-page.home-v2 .home-v2-list-item p,
    .home-page.home-v2 .home-v2-step p,
    .entry-conversion-copy p {
        font-size: 0.92rem !important;
        line-height: 1.48 !important;
    }

    .home-page.home-v2 .home-v2-preview-row,
    .home-page.home-v2 .home-v2-list-item,
    .home-page.home-v2 .home-v2-step {
        padding: 0.66rem 0.64rem !important;
    }

    .home-page.home-v2 .home-v2-proof,
    .home-page.home-v2 .home-v2-sections,
    .home-page.home-v2 .home-v2-final {
        margin-top: 0.68rem !important;
        gap: 0.58rem !important;
    }

    .home-page.home-v2 .home-v2-actions {
        gap: 0.48rem !important;
    }

    .home-page.home-v2 .home-v2-preview-row:nth-child(n+4) {
        display: none !important;
    }

    .market-directory-page .directory-header h1,
    .companies-page .directory-header h1,
    .social-page .directory-header h1,
    .public-portfolio-page .directory-header h1,
    .stock-detail-page .directory-header h1,
    .portfolio-page .directory-header h1 {
        font-size: clamp(1.36rem, 6.1vw, 1.76rem) !important;
        line-height: 1.18 !important;
    }

    .market-directory-page .directory-header .subtitle,
    .companies-page .directory-header .subtitle,
    .social-page .directory-header .subtitle,
    .public-portfolio-page .directory-header .subtitle,
    .stock-detail-page .directory-header .subtitle,
    .portfolio-page .directory-header .subtitle {
        font-size: 0.95rem !important;
        line-height: 1.5 !important;
    }

    .market-table tr,
    .portfolio-page .holdings-table tr,
    .public-portfolio-page .public-holdings-table tr,
    .social-page .social-table tr {
        padding: 0.62rem 0.66rem !important;
        gap: 0.34rem !important;
        border-radius: 10px !important;
    }

    .market-table td,
    .portfolio-page .holdings-table td,
    .public-portfolio-page .public-holdings-table td,
    .social-page .social-table td {
        padding: 0.2rem 0 !important;
        font-size: 0.93rem !important;
        line-height: 1.44 !important;
    }

    .market-table td::before,
    .portfolio-page .holdings-table td::before,
    .public-portfolio-page .public-holdings-table td::before,
    .social-page .social-table td::before {
        font-size: 0.67rem !important;
        letter-spacing: 0.055em !important;
        color: #a9bed7 !important;
    }

    .market-table td.ticker-cell strong,
    .portfolio-page .holdings-table td strong,
    .public-portfolio-page .public-holdings-table td strong,
    .social-page .social-table td strong {
        font-size: 0.99rem !important;
    }

    .entry-conversion-actions {
        grid-template-columns: 1fr !important;
    }

    .mobile-dock-link {
        min-height: 58px !important;
        font-size: 0.72rem !important;
    }

    .mobile-dock-text {
        font-size: 0.7rem !important;
    }
}

@media (max-width: 430px) {
    .home-page.home-v2 .home-v2-copy h1 {
        font-size: clamp(1.46rem, 7.8vw, 1.82rem) !important;
    }

    .home-page.home-v2 .home-v2-subtitle,
    .home-page.home-v2 .home-v2-note,
    .market-directory-page .directory-header .subtitle,
    .companies-page .directory-header .subtitle,
    .social-page .directory-header .subtitle,
    .public-portfolio-page .directory-header .subtitle,
    .stock-detail-page .directory-header .subtitle,
    .portfolio-page .directory-header .subtitle {
        font-size: 0.92rem !important;
    }

    .market-table td,
    .portfolio-page .holdings-table td,
    .public-portfolio-page .public-holdings-table td,
    .social-page .social-table td {
        font-size: 0.88rem !important;
    }
}

/* Mobile layout polish: final shared pass for phone-first usability */
@media (max-width: 900px) {
    body.has-mobile-dock,
    body.has-mobile-cta {
        padding-bottom: calc(96px + env(safe-area-inset-bottom)) !important;
    }

    input:not([type="checkbox"]):not([type="radio"]):not([type="range"]),
    select,
    textarea {
        font-size: 16px !important;
    }

    header {
        box-shadow: 0 10px 30px rgba(2, 6, 23, 0.28);
    }

    .header-inner {
        display: grid !important;
        grid-template-columns: minmax(0, 1fr) auto auto !important;
        gap: 0.5rem !important;
        min-height: 64px !important;
        padding: 0 0.78rem !important;
    }

    .logo {
        min-width: 0;
        max-width: 100%;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .beta-tag {
        font-size: 0.58rem;
        padding: 0.14rem 0.34rem;
        vertical-align: middle;
    }

    .mobile-top-actions {
        justify-self: end;
        gap: 0.38rem !important;
        margin-right: 0 !important;
        max-width: 100%;
    }

    .mobile-auth-shortcut,
    .mobile-lang-shortcut {
        min-height: 35px !important;
        box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
        backdrop-filter: blur(10px);
    }

    .mobile-auth-shortcut.account,
    .mobile-auth-shortcut.login {
        min-width: 72px !important;
    }

    .mobile-menu-toggle {
        border-radius: 12px;
        background: rgba(255, 255, 255, 0.03);
        border: 1px solid rgba(96, 165, 250, 0.16);
    }

    .main-nav {
        width: min(84vw, 348px) !important;
        padding: calc(0.82rem + env(safe-area-inset-top)) 0.9rem 1.05rem !important;
        background:
            linear-gradient(180deg, rgba(8, 14, 28, 0.99) 0%, rgba(13, 24, 42, 0.985) 100%) !important;
        border-left: 1px solid rgba(106, 137, 174, 0.26) !important;
        box-shadow: -18px 0 40px rgba(2, 6, 23, 0.56) !important;
    }

    .nav-mobile-head {
        position: sticky;
        top: calc(env(safe-area-inset-top) * -1);
        margin: -0.1rem 0 0.5rem;
        padding-top: 0.15rem;
        background: linear-gradient(180deg, rgba(8, 14, 28, 0.98) 0%, rgba(8, 14, 28, 0.92) 100%);
        z-index: 2;
    }

    .nav-mobile-auth {
        gap: 0.62rem !important;
        margin-top: 0.2rem !important;
        margin-bottom: 0.62rem !important;
        padding: 0.2rem 0 0.95rem !important;
    }

    .nav-mobile-auth .nav-mobile-auth-btn {
        min-height: 48px !important;
        background: rgba(255, 255, 255, 0.035);
        border: 1px solid rgba(106, 137, 174, 0.2);
    }

    .nav-links {
        gap: 0.34rem !important;
    }

    .nav-link {
        min-height: 48px !important;
        padding: 0.82rem 0.8rem !important;
        border-radius: 13px !important;
        background: rgba(255, 255, 255, 0.025);
        border-color: rgba(106, 137, 174, 0.14) !important;
    }

    .nav-link.active {
        background: linear-gradient(180deg, rgba(23, 72, 130, 0.34), rgba(11, 34, 66, 0.4)) !important;
        border-color: rgba(103, 181, 255, 0.34) !important;
        box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
    }

    .nav-link-icon {
        width: 1.18rem !important;
        height: 1.18rem !important;
    }

    .nav-utils {
        gap: 0.72rem !important;
        margin-top: 0.72rem !important;
        padding-top: 0.88rem !important;
    }

    .header-stock-search input {
        min-height: 46px !important;
        border-radius: 12px !important;
        padding-left: 2.15rem !important;
    }

    .lang-switcher {
        width: 100%;
    }

    .directory-header,
    .stock-card-hero,
    .portfolio-page .directory-header {
        gap: 0.7rem;
    }

    .table-container,
    .chart-container,
    .portfolio-page .panel,
    .stock-insight-card {
        overflow: hidden;
    }

    .main-footer {
        margin-top: 2.8rem !important;
        padding: 2.7rem 0 calc(6.4rem + env(safe-area-inset-bottom)) !important;
        background:
            linear-gradient(180deg, rgba(2, 6, 23, 0.88) 0%, rgba(2, 6, 23, 1) 100%) !important;
    }

    .footer-grid {
        gap: 1.1rem !important;
        margin-bottom: 1.5rem !important;
    }

    .f-col {
        padding: 1rem 1rem 0.95rem;
        border-radius: 14px;
        border: 1px solid rgba(79, 104, 140, 0.26);
        background: rgba(11, 18, 33, 0.78);
    }

    .f-col h4 {
        margin-bottom: 0.75rem !important;
        font-size: 0.94rem !important;
    }

    .f-col p,
    .contact-info,
    .footer-links a {
        font-size: 0.84rem !important;
        line-height: 1.55 !important;
    }

    .footer-links {
        display: grid;
        gap: 0.55rem;
        margin-top: 0.9rem;
    }

    .footer-links a {
        margin: 0 !important;
        padding-bottom: 0.24rem;
        width: fit-content;
    }

    .disclaimer-box {
        margin-bottom: 1.5rem !important;
        padding: 1rem !important;
        border-radius: 14px !important;
        font-size: 0.78rem !important;
        line-height: 1.55 !important;
    }

    .footer-bottom {
        padding-top: 1.2rem !important;
        text-align: left !important;
    }

    .mobile-dock,
    .mobile-dock.is-authenticated,
    .mobile-dock.is-guest {
        left: 0.45rem !important;
        right: 0.45rem !important;
        bottom: max(0.45rem, env(safe-area-inset-bottom)) !important;
        gap: 0.32rem !important;
        padding: 0.36rem !important;
        border: 1px solid rgba(82, 107, 141, 0.34) !important;
        border-radius: 18px !important;
        background: linear-gradient(180deg, rgba(6, 13, 25, 0.95), rgba(4, 9, 19, 0.98)) !important;
        box-shadow: 0 14px 34px rgba(2, 6, 23, 0.42) !important;
    }

    .mobile-dock-link {
        min-height: 58px !important;
        gap: 0.22rem !important;
        border-radius: 14px !important;
        border-color: transparent !important;
        background: transparent !important;
        padding: 0.36rem 0.2rem !important;
    }

    .mobile-dock-link.active {
        background: linear-gradient(180deg, rgba(24, 83, 152, 0.34), rgba(10, 36, 68, 0.42)) !important;
        border-color: rgba(103, 181, 255, 0.34) !important;
        box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
    }

    .mobile-dock-link.is-auth {
        background: linear-gradient(180deg, rgba(20, 70, 140, 0.36), rgba(10, 39, 87, 0.42)) !important;
    }

    .mobile-dock-icon {
        width: 1.08rem !important;
        height: 1.08rem !important;
    }

    .mobile-dock-text {
        font-size: 0.68rem !important;
        letter-spacing: 0.02em;
    }
}

@media (max-width: 430px) {
    .header-inner {
        gap: 0.36rem !important;
        padding: 0 0.62rem !important;
    }

    .logo {
        font-size: 1rem !important;
    }

    .beta-tag {
        display: none;
    }

    .mobile-top-actions {
        gap: 0.28rem !important;
    }

    .mobile-auth-shortcut,
    .mobile-lang-shortcut {
        padding: 0.32rem 0.54rem !important;
    }

    .mobile-auth-shortcut.account,
    .mobile-auth-shortcut.login {
        min-width: 64px !important;
    }

    .main-nav {
        width: min(100vw, 320px) !important;
        padding-left: 0.8rem !important;
        padding-right: 0.8rem !important;
    }

    .f-col {
        padding: 0.92rem 0.88rem 0.88rem;
    }

    .mobile-dock,
    .mobile-dock.is-authenticated,
    .mobile-dock.is-guest {
        left: 0.38rem !important;
        right: 0.38rem !important;
    }

    .mobile-dock-text {
        font-size: 0.64rem !important;
    }
}

/* Mobile page activation pass: market, social, and public portfolio */
@media (max-width: 900px) {
    .home-page.home-v2 {
        padding-top: 0.95rem !important;
    }

    .home-page.home-v2 .home-v2-hero {
        gap: 0.9rem !important;
    }

    .home-page.home-v2 .home-v2-preview {
        margin-top: 0 !important;
    }

    .home-page.home-v2 .home-v2-preview-list {
        gap: 0 !important;
    }

    .home-page.home-v2 .home-v2-preview-row {
        padding: 0.78rem 0.72rem !important;
    }

    .home-page.home-v2 .home-v2-actions,
    .home-page.home-v2 .home-v2-actions.home-v2-actions-final {
        grid-template-columns: 1fr !important;
        width: 100%;
    }

    .market-directory-page .directory-header,
    .social-page .directory-header,
    .public-portfolio-page .directory-header,
    .stock-detail-page .directory-header {
        padding-top: 1.1rem !important;
        gap: 0.72rem !important;
    }

    .market-directory-page .market-search {
        width: 100% !important;
        max-width: 100% !important;
        min-height: 46px !important;
        margin-top: 0.15rem;
        box-sizing: border-box;
    }

    .market-directory-page .table-container,
    .social-page .social-table-container,
    .public-portfolio-page .public-holdings-container {
        border-radius: 14px !important;
    }

    .market-directory-page .market-table tr,
    .social-page .social-table tr {
        padding: 0.74rem 0.72rem !important;
    }

    .market-directory-page .name-value,
    .public-portfolio-page .holding-name {
        display: flex;
        align-items: flex-start;
        gap: 0.42rem;
        flex-wrap: wrap;
    }

    .stock-detail-page .stock-detail-actions {
        display: grid !important;
        grid-template-columns: 1fr !important;
        gap: 0.55rem !important;
        margin-bottom: 1rem !important;
    }

    .stock-detail-page .related-stock-grid {
        padding-bottom: 0 !important;
    }

    .stock-detail-page .dividend-history-panel {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .social-page .social-guest-cta,
    .public-portfolio-page .directory-header form,
    .public-portfolio-page .directory-header > a.btn-primary {
        width: 100%;
    }

    .social-page .social-guest-cta .btn-primary,
    .public-portfolio-page .directory-header form .btn-primary,
    .public-portfolio-page .directory-header > a.btn-primary {
        width: 100%;
        text-align: center;
    }

    .public-portfolio-page .directory-header {
        display: flex !important;
        flex-direction: column !important;
        align-items: stretch !important;
    }

    .public-portfolio-page .top-stats {
        gap: 0.7rem !important;
        margin-bottom: 1rem !important;
    }

    .public-portfolio-page .chart-container {
        padding: 1rem !important;
        margin-bottom: 1rem !important;
    }
}

@media (max-width: 430px) {
    .home-page.home-v2 .home-v2-preview-row {
        padding: 0.72rem 0.64rem !important;
    }

    .market-directory-page .market-table td,
    .social-page .social-table td,
    .public-portfolio-page .public-holdings-table td {
        padding-left: 0 !important;
        padding-right: 0 !important;
    }

    .stock-detail-page .stock-insight-card {
        padding: 0.82rem !important;
    }
}

/* Mobile polish pass: companies, profile, legal */
@media (max-width: 900px) {
    .companies-page .directory-header {
        gap: 0.62rem !important;
    }

    .companies-page .entry-conversion {
        margin-top: 0.72rem !important;
    }

    .companies-page .entry-conversion-metrics {
        gap: 0.42rem !important;
    }

    .companies-page .entry-conversion-metric {
        min-height: 92px;
    }

    .companies-page .market-table td.small-caps .cell-value {
        justify-content: flex-start;
        text-align: left;
    }

    .companies-page .market-table td:nth-child(2) .cell-value {
        display: block;
    }

    .companies-page .market-table td:nth-child(2) .company-name {
        display: block;
        line-height: 1.42;
    }

    .companies-page .market-table td[colspan] {
        text-align: center;
        justify-content: center;
        color: var(--text-secondary);
        font-weight: 700;
        min-height: 92px;
    }

    .profile-page .profile-container {
        margin-top: 0.78rem !important;
    }

    .profile-page .profile-section {
        border-radius: 14px !important;
    }

    .profile-page .checkbox-group {
        align-items: flex-start;
        line-height: 1.45;
    }

    .profile-page .checkbox-group input[type="checkbox"] {
        margin-top: 0.1rem;
        flex: 0 0 auto;
    }

    .profile-page .delete-section {
        margin-top: 0.2rem;
    }

    .legal-page {
        padding-top: 0.92rem;
    }

    .legal-page .legal-card {
        border-radius: 16px !important;
    }

    .legal-page .legal-card h1 {
        line-height: 1.16;
    }

    .legal-page .legal-card section {
        padding: 0.45rem 0 !important;
    }
}

@media (max-width: 430px) {
    .companies-page .letter-chip {
        min-width: 38px !important;
        height: 38px !important;
        padding: 0 0.5rem !important;
    }

    .companies-page .entry-conversion-metric {
        min-height: 84px;
    }

    .profile-page .checkbox-group {
        padding: 0.5rem 0.54rem !important;
    }

    .legal-page .legal-card {
        padding: 0.92rem !important;
    }
}

/* Mobile stabilization pass: prevent clipped data cells and off-canvas bleed */
@media (max-width: 900px) {
    html,
    body {
        width: 100%;
        max-width: 100%;
        overflow-x: clip;
    }

    .container {
        width: 100%;
        max-width: 100%;
    }

    /* Keep hidden mobile nav outside interaction without widening layout. */
    .main-nav {
        width: min(84vw, 348px) !important;
        max-width: min(84vw, 348px) !important;
        right: 0 !important;
        transform: none !important;
        clip-path: inset(0 0 0 100%);
        opacity: 0;
        visibility: hidden;
        pointer-events: none;
        transition: clip-path 0.28s ease, opacity 0.2s ease, visibility 0s linear 0.28s !important;
    }

    .main-nav.active {
        clip-path: inset(0 0 0 0) !important;
        opacity: 1 !important;
        visibility: visible !important;
        pointer-events: auto !important;
        transition: clip-path 0.28s ease, opacity 0.2s ease !important;
    }

    .market-directory-page .table-container,
    .companies-page .table-container,
    .social-page .social-table-container,
    .public-portfolio-page .public-holdings-container,
    .portfolio-page .holdings-container {
        overflow: hidden !important;
    }

    .market-directory-page .market-table tr,
    .companies-page .market-table tr,
    .social-page .social-table tr,
    .public-portfolio-page .public-holdings-table tr,
    .portfolio-page .holdings-table tr {
        padding: 0 !important;
        width: 100% !important;
        box-sizing: border-box !important;
    }

    .market-directory-page .market-table td,
    .companies-page .market-table td,
    .social-page .social-table td,
    .public-portfolio-page .public-holdings-table td,
    .portfolio-page .holdings-table td {
        display: grid !important;
        grid-template-columns: minmax(72px, 92px) minmax(0, 1fr) !important;
        align-items: start !important;
        gap: 0.22rem 0.72rem !important;
        width: auto !important;
        box-sizing: border-box !important;
        padding: 0.66rem 0.86rem !important;
    }

    .market-directory-page .market-table td .cell-value,
    .companies-page .market-table td .cell-value,
    .social-page .social-table td .cell-value,
    .public-portfolio-page .public-holdings-table td .cell-value,
    .portfolio-page .holdings-table td .cell-value {
        min-width: 0;
        max-width: 100%;
        display: inline-flex;
        align-items: center;
        justify-content: flex-start;
        gap: 0.4rem;
        overflow-wrap: anywhere;
    }

    .market-directory-page .market-table td.text-right .cell-value,
    .companies-page .market-table td.text-right .cell-value,
    .social-page .social-table td.text-right .cell-value,
    .public-portfolio-page .public-holdings-table td.text-right .cell-value,
    .portfolio-page .holdings-table td.text-right .cell-value {
        width: 100%;
        justify-content: flex-end !important;
        text-align: right;
    }

    .companies-page .letter-filter {
        flex-wrap: nowrap !important;
        overflow-x: auto !important;
        overscroll-behavior-x: contain;
        scroll-snap-type: x proximity;
        padding-bottom: 0.24rem !important;
    }

    .companies-page .letter-chip {
        flex: 0 0 auto;
        scroll-snap-align: start;
    }
}

@media (max-width: 430px) {
    .market-directory-page .market-table td,
    .companies-page .market-table td,
    .social-page .social-table td,
    .public-portfolio-page .public-holdings-table td,
    .portfolio-page .holdings-table td {
        grid-template-columns: minmax(68px, 84px) minmax(0, 1fr) !important;
        padding: 0.6rem 0.74rem !important;
    }
}

/* Unified interface pass: simplify and normalize the public site */
:root {
    --bg-root: #06111d;
    --bg-card: #0d1a2d;
    --bg-card-hover: #13253c;
    --text-primary: #f4f8fb;
    --text-secondary: #c3d1e0;
    --text-muted: #8397b0;
    --border-subtle: #223954;
    --border-active: #33597f;
    --accent-brand: #78b3ff;
    --focus-ring: rgba(120, 179, 255, 0.36);
}

body {
    background:
        radial-gradient(circle at top, rgba(27, 54, 86, 0.42) 0%, rgba(10, 21, 37, 0) 30%),
        linear-gradient(180deg, #07111d 0%, #040b14 100%) !important;
    color: var(--text-primary);
}

.container {
    max-width: 1240px;
    padding-left: clamp(1rem, 2vw, 1.5rem) !important;
    padding-right: clamp(1rem, 2vw, 1.5rem) !important;
}

header {
    background: rgba(7, 15, 26, 0.96) !important;
    border-bottom: 1px solid rgba(51, 89, 127, 0.34) !important;
    backdrop-filter: none !important;
    box-shadow: none !important;
}

.header-inner {
    max-width: 1240px;
    min-height: 72px !important;
    padding: 0 clamp(1rem, 2vw, 1.5rem) !important;
    gap: 1rem;
}

.logo {
    font-size: 1.08rem !important;
    font-weight: 800 !important;
    letter-spacing: -0.04em !important;
}

.beta-tag {
    background: rgba(120, 179, 255, 0.12);
    border: 1px solid rgba(120, 179, 255, 0.22);
    color: #dce9f8;
}

.main-nav {
    margin-left: 2rem;
}

.nav-links {
    gap: 0.55rem;
}

.nav-link {
    display: inline-flex;
    align-items: center;
    min-height: 42px;
    padding: 0.6rem 0.88rem;
    border-radius: 999px;
    border: 1px solid transparent;
    color: var(--text-secondary);
}

.nav-link:hover,
.nav-link.active {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.04);
    border-color: rgba(51, 89, 127, 0.34);
}

.header-stock-search input,
.market-search,
.search-box input,
.profile-page input[type="text"],
.profile-page select,
.portfolio-page input:not([type="checkbox"]):not([type="radio"]),
.portfolio-page select,
.public-portfolio-page input:not([type="checkbox"]):not([type="radio"]),
.public-portfolio-page select {
    background: rgba(5, 13, 24, 0.9) !important;
    border: 1px solid rgba(51, 89, 127, 0.54) !important;
    border-radius: 14px !important;
    color: var(--text-primary) !important;
    box-shadow: none !important;
}

.header-stock-search input:focus,
.market-search:focus,
.search-box input:focus,
.profile-page input[type="text"]:focus,
.profile-page select:focus,
.portfolio-page input:not([type="checkbox"]):not([type="radio"]):focus,
.portfolio-page select:focus,
.public-portfolio-page input:not([type="checkbox"]):not([type="radio"]):focus,
.public-portfolio-page select:focus {
    outline: none;
    border-color: var(--accent-brand) !important;
    box-shadow: 0 0 0 3px rgba(120, 179, 255, 0.14) !important;
}

.btn-primary,
.btn-secondary,
.nav-btn,
.btn-save,
.btn-delete,
.btn-export,
.badge-mini.action-link,
.social-follow-btn {
    min-height: 46px;
    border-radius: 12px !important;
    font-weight: 800 !important;
    letter-spacing: -0.01em;
    box-shadow: none !important;
    padding: 0.68rem 1rem;
}

.btn-primary,
.btn-save {
    background: linear-gradient(180deg, #edf4fc 0%, #d7e6f6 100%) !important;
    border: 1px solid #d7e6f6 !important;
    color: #081321 !important;
}

.btn-secondary,
.nav-btn,
.btn-export {
    background: rgba(12, 24, 39, 0.92) !important;
    border: 1px solid rgba(51, 89, 127, 0.58) !important;
    color: var(--text-primary) !important;
}

.btn-delete {
    background: rgba(96, 26, 26, 0.12) !important;
    border: 1px solid rgba(239, 68, 68, 0.42) !important;
    color: #ffb4b4 !important;
}

.nav-btn-icon {
    width: 46px;
    min-width: 46px;
    padding: 0 !important;
    justify-content: center !important;
}

.nav-btn-icon svg {
    width: 1.05rem;
    height: 1.05rem;
    stroke: currentColor;
    fill: none;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.home-page,
.market-directory-page,
.companies-page,
.social-page,
.public-portfolio-page,
.portfolio-page,
.profile-page,
.legal-page,
.stock-detail-page {
    padding-top: 1.25rem;
    padding-bottom: 3.5rem;
}

.directory-header,
.home-v2-hero,
.home-v2-conversion,
.home-v2-block,
.entry-conversion,
.stock-insight-card,
.profile-page .profile-section,
.legal-page .legal-card,
.portfolio-page .sidebar,
.portfolio-page .portfolio-toolbar,
.portfolio-page .estimate-section,
.portfolio-page .optimizer-suggestions,
.portfolio-page .export-section,
.portfolio-page .import-section,
.public-portfolio-page .dividend-event-list,
.public-portfolio-page .dividend-history-dropdown,
.table-container,
.chart-container {
    background: linear-gradient(180deg, rgba(14, 26, 42, 0.96), rgba(10, 19, 31, 0.98)) !important;
    border: 1px solid rgba(51, 89, 127, 0.38) !important;
    border-radius: 18px !important;
    box-shadow: 0 16px 38px rgba(0, 0, 0, 0.18) !important;
}

.directory-header,
.home-v2-hero,
.home-v2-conversion,
.home-v2-block,
.entry-conversion {
    padding: 1.4rem 1.5rem;
}

.directory-header > * + * {
    margin-top: 0.7rem;
}

.directory-header h1,
.stock-detail-page .directory-header h1,
.portfolio-page .directory-header h1,
.public-portfolio-page .directory-header h1 {
    font-size: clamp(1.8rem, 3vw, 2.7rem) !important;
    line-height: 1.08 !important;
    letter-spacing: -0.04em !important;
}

.directory-header .subtitle,
.home-v2-subtitle,
.home-v2-note,
.entry-conversion-copy p,
.public-portfolio-page .directory-header .subtitle,
.stock-detail-page .directory-header .subtitle {
    max-width: 48rem;
    color: var(--text-secondary) !important;
    font-size: 0.95rem;
    line-height: 1.58;
}

.directory-meta {
    margin-top: 0;
    color: var(--text-muted) !important;
    font-size: 0.84rem;
    line-height: 1.5;
}

.directory-header .market-search {
    margin-top: 0.9rem;
}

.directory-header.split-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: 1rem;
}

.social-guest-cta {
    margin-top: 0.4rem;
    justify-content: flex-start;
}

.companies-page .directory-header .market-search {
    width: min(100%, 34rem);
}

.companies-page .letter-filter {
    display: flex;
    flex-wrap: wrap;
    gap: 0.55rem;
    margin-top: 0.95rem;
}

.companies-page .letter-chip {
    min-height: 42px;
    padding: 0.55rem 0.8rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.social-page .social-guest-cta {
    width: 100%;
    margin-top: 0.9rem;
}

.social-page .social-guest-cta .btn-primary {
    min-width: 220px;
}

.hero-actions,
.home-v2-actions,
.entry-conversion-actions,
.stock-detail-actions,
.social-guest-cta {
    gap: 0.65rem;
}

.home-v2-hero {
    display: grid;
    grid-template-columns: minmax(0, 1.15fr) minmax(320px, 0.85fr);
    gap: 1.15rem;
    align-items: start;
}

.home-v2-eyebrow,
.home-v2-links,
.home-v2-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.7rem;
}

.home-v2-chip {
    border-radius: 999px;
    border: 1px solid rgba(120, 179, 255, 0.32);
    background: rgba(120, 179, 255, 0.1);
    color: #dce8f8;
    padding: 0.36rem 0.7rem;
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.04em;
}

.home-v2-search {
    margin: 1rem 0 0;
}

.home-v2-actions {
    margin-top: 1rem;
}

.home-v2-trust-list {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.75rem;
    margin-top: 1rem;
}

.home-v2-trust-item {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    padding: 0.85rem 0.95rem;
    border-radius: 14px;
    border: 1px solid rgba(57, 194, 255, 0.18);
    border-top: 2px solid rgba(57, 194, 255, 0.42);
    background: rgba(57, 194, 255, 0.03);
}

.home-v2-trust-item strong {
    font-size: 0.88rem;
    font-weight: 800;
    color: var(--text-primary);
}

.home-v2-trust-item span {
    color: var(--text-secondary);
    font-size: 0.81rem;
    line-height: 1.45;
}

.home-v2-actions .btn-primary,
.home-v2-actions .btn-secondary,
.entry-conversion-actions .btn-primary,
.entry-conversion-actions .btn-secondary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 184px;
}

.home-v2-preview-list,
.home-v2-block-list,
.home-v2-steps {
    display: grid;
    gap: 0.75rem;
}

.home-v2-preview-row,
.home-v2-list-item,
.home-v2-step,
.entry-conversion-metric {
    border: 1px solid rgba(51, 89, 127, 0.3);
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.02);
    padding: 0.9rem 1rem;
    transition: background 0.15s ease, border-color 0.15s ease;
}

@media (hover: hover) {
    .home-v2-preview-row:hover {
        background: rgba(57, 194, 255, 0.05);
        border-color: rgba(57, 194, 255, 0.26);
    }
}

.home-v2-conversion {
    display: grid;
    grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.95fr) auto;
    gap: 1rem;
    align-items: center;
    margin-top: 1rem;
}

.home-v2-conversion-metrics,
.entry-conversion-metrics {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.75rem;
}

.home-v2-conversion-value,
.entry-conversion-value {
    display: block;
    font-size: 1.45rem;
    font-weight: 800;
    color: var(--text-primary);
}

.home-v2-conversion-label,
.entry-conversion-label {
    display: block;
    margin-top: 0.2rem;
    color: var(--text-muted);
    font-size: 0.76rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.home-v2-sections {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
    margin-top: 1rem;
}

.home-v2-step {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 0.75rem;
    align-items: start;
}

.home-v2-step-index {
    width: 2rem;
    height: 2rem;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(120, 179, 255, 0.12);
    border: 1px solid rgba(120, 179, 255, 0.24);
    color: #e5eef9;
    font-weight: 800;
}

.home-v2-focus-strip {
    display: grid;
    gap: 1rem;
    margin-top: 1rem;
    padding: 1.35rem 1.5rem;
    border-radius: 18px;
    border: 1px solid rgba(51, 89, 127, 0.3);
    background: linear-gradient(180deg, rgba(12, 23, 38, 0.92), rgba(8, 17, 29, 0.98));
}

.home-v2-focus-head h2 {
    margin: 0;
    font-size: clamp(1.15rem, 3vw, 1.55rem);
    background: linear-gradient(125deg, var(--text-primary) 25%, #8eccf5 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    color: transparent;
}

.home-v2-focus-head p {
    margin: 0.35rem 0 0;
    color: var(--text-secondary);
    font-size: 0.9rem;
    max-width: 48rem;
}

.home-v2-focus-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.75rem;
}

.home-v2-focus-card {
    padding: 1rem 1.05rem;
    border-radius: 14px;
    border: 1px solid rgba(57, 194, 255, 0.2);
    border-top: 2px solid rgba(57, 194, 255, 0.5);
    background: rgba(57, 194, 255, 0.03);
    transition: background 0.15s ease, border-color 0.15s ease;
}

@media (hover: hover) {
    .home-v2-focus-card:hover {
        background: rgba(57, 194, 255, 0.06);
        border-color: rgba(57, 194, 255, 0.3);
        border-top-color: rgba(57, 194, 255, 0.7);
    }
}

.home-v2-focus-card h3 {
    font-size: 0.97rem;
    font-weight: 800;
    margin-bottom: 0.35rem;
    color: var(--text-primary);
}

.home-v2-focus-card p {
    margin: 0;
    color: var(--text-secondary);
    font-size: 0.84rem;
    line-height: 1.5;
}

.companies-page .letter-filter {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.8rem;
}

.companies-page .letter-chip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 42px;
    min-height: 42px;
    padding: 0 0.75rem;
    border-radius: 999px;
    border: 1px solid rgba(51, 89, 127, 0.44) !important;
    background: rgba(255, 255, 255, 0.02) !important;
    color: var(--text-secondary) !important;
    font-size: 0.78rem;
    font-weight: 800;
    text-decoration: none;
}

.companies-page .letter-chip.active {
    background: #edf4fc !important;
    border-color: #edf4fc !important;
    color: #081321 !important;
}

.market-table,
.social-table,
.public-holdings-table,
.holdings-table {
    width: 100%;
    border-collapse: collapse;
}

.market-table thead th,
.social-table thead th,
.public-holdings-table thead th,
.holdings-table thead th {
    padding: 0.84rem 0.95rem;
    color: var(--text-muted);
    font-size: 0.68rem;
    font-weight: 800;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    border-bottom: 1px solid rgba(51, 89, 127, 0.3);
}

.market-table td,
.social-table td,
.public-holdings-table td,
.holdings-table td {
    padding: 0.92rem 0.95rem;
    border-bottom: 1px solid rgba(51, 89, 127, 0.22);
    vertical-align: middle;
}

.market-table tbody tr:hover,
.social-table tbody tr:hover,
.public-holdings-table tbody tr:hover {
    background: rgba(255, 255, 255, 0.02);
}

.market-table td .cell-value,
.social-table td .cell-value,
.public-holdings-table td .cell-value {
    min-width: 0;
}

.social-actions {
    display: flex;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 0.45rem;
}

.social-follow-form {
    margin: 0;
}

.stock-trust-stats {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.75rem;
    margin-top: 0.75rem;
}

.stock-trust-stats .t-stat {
    min-height: 84px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 0.18rem;
    border-radius: 14px;
    border: 1px solid rgba(51, 89, 127, 0.34);
    background: rgba(255, 255, 255, 0.02);
}

.stock-detail-header {
    padding-bottom: 1rem;
}

.stock-decision-hero {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 1rem;
    align-items: start;
}

.stock-decision-copy {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
}

.stock-decision-kicker {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 28px;
    padding: 0.2rem 0.6rem;
    border-radius: 999px;
    border: 1px solid rgba(120, 179, 255, 0.28);
    background: rgba(120, 179, 255, 0.1);
    color: #dce8f8;
    font-size: 0.7rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.stock-decision-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 36px;
    padding: 0.35rem 0.85rem;
    border-radius: 999px;
    font-size: 0.84rem;
    font-weight: 800;
    letter-spacing: 0.04em;
    border: 1px solid transparent;
}

.stock-decision-pill.buy {
    background: rgba(16, 185, 129, 0.14);
    border-color: rgba(16, 185, 129, 0.36);
    color: #8cf3c9;
}

.stock-decision-pill.hold {
    background: rgba(245, 158, 11, 0.14);
    border-color: rgba(245, 158, 11, 0.36);
    color: #ffd58a;
}

.stock-decision-pill.sell {
    background: rgba(239, 68, 68, 0.14);
    border-color: rgba(239, 68, 68, 0.36);
    color: #ffb4b4;
}

.stock-decision-title {
    margin: 0;
    font-size: 1.02rem;
    font-weight: 800;
    color: var(--text-primary);
}

.holding-decision-line {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.45rem;
    margin-top: 0.55rem;
}

.holding-return-chip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 28px;
    padding: 0.18rem 0.5rem;
    border-radius: 999px;
    border: 1px solid rgba(51, 89, 127, 0.3);
    background: rgba(255, 255, 255, 0.03);
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.03em;
}

.holding-return-chip.buy {
    color: #8cf3c9;
    border-color: rgba(16, 185, 129, 0.32);
    background: rgba(16, 185, 129, 0.12);
}

.holding-return-chip.sell {
    color: #ffb4b4;
    border-color: rgba(239, 68, 68, 0.32);
    background: rgba(239, 68, 68, 0.12);
}

.day-change-chip {
    opacity: 0.9;
    font-weight: 700;
}

.totals-mode-toggle {
    display: inline-flex;
    align-items: center;
    gap: 0.34rem;
    margin: 0 0 0.9rem;
    padding: 0.3rem;
    border-radius: 999px;
    border: 1px solid rgba(51, 89, 127, 0.3);
    background: rgba(8, 14, 26, 0.35);
}

.totals-mode-label {
    font-size: 0.66rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-weight: 700;
    padding: 0 0.3rem 0 0.2rem;
}

.totals-mode-btn {
    min-height: 34px;
    padding: 0.36rem 0.78rem;
    border: 0;
    border-radius: 999px;
    background: transparent;
    color: var(--text-secondary);
    font-size: 0.78rem;
    font-weight: 700;
    cursor: pointer;
}

.totals-mode-btn.is-active {
    background: rgba(56, 189, 248, 0.16);
    color: #f8fbff;
    box-shadow: inset 0 0 0 1px rgba(56, 189, 248, 0.22);
}

.holding-dividend-cell {
    min-width: 150px;
}

.holding-dividend-summary {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.12rem;
}

.holding-dividend-value {
    font-weight: 800;
    color: var(--text-primary);
    line-height: 1.2;
}

.holding-dividend-meta {
    font-size: 0.68rem;
    color: var(--text-muted);
    line-height: 1.35;
}

.holding-dividend-next {
    font-size: 0.68rem;
    color: var(--text-secondary);
    line-height: 1.35;
}

.holding-dividend-next.forecast {
    color: #fcd34d;
}

.holding-dividend-yield {
    font-size: 0.7rem;
    font-weight: 700;
    color: rgba(57, 194, 255, 0.88);
    letter-spacing: 0.03em;
    line-height: 1.35;
}
.holding-dividend-stipulated-mark {
    font-size: 0.68rem;
    font-weight: 700;
    color: rgba(245, 158, 11, 0.8);
    cursor: default;
    margin-left: 0.08em;
    vertical-align: middle;
}

.holding-quick-facts {
    display: none;
}

.holding-support-grid {
    display: grid;
    grid-template-columns: minmax(0, 0.95fr) minmax(0, 0.95fr) minmax(0, 1.2fr);
    gap: 0.75rem;
}

.holding-support-panel {
    min-width: 0;
    padding: 0.58rem 0.72rem;
    border-radius: 8px;
    border: 1px solid rgba(51, 89, 127, 0.18);
    background: rgba(6, 12, 22, 0.26);
    box-shadow: none;
}

.holding-support-panel.tone-good {
    border-color: rgba(16, 185, 129, 0.3);
}

.holding-support-panel.tone-warn {
    border-color: rgba(245, 158, 11, 0.3);
}

.holding-support-panel.tone-risk {
    border-color: rgba(239, 68, 68, 0.3);
}

/* === Panel header row === */
.hsp-head {
    display: flex;
    align-items: center;
    gap: 0.38rem;
    flex-wrap: wrap;
}

.hsp-type-tag {
    flex-shrink: 0;
    font-size: 0.58rem;
    font-weight: 800;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--text-muted);
    padding-right: 0.42rem;
    border-right: 1px solid rgba(100, 116, 139, 0.28);
    margin-right: 0.04rem;
    line-height: 1;
    white-space: nowrap;
}

.hsp-primary-text {
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--text-secondary);
    white-space: nowrap;
}

.hsp-amount {
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--text-primary);
    white-space: nowrap;
}

/* Secondary chips row */
.hsp-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.26rem;
    margin-top: 0.3rem;
}

/* Sector direction + delta row */
.hsp-detail-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.28rem;
    font-size: 0.68rem;
    color: var(--text-secondary);
    line-height: 1.3;
}

.hsp-detail-item {
    white-space: nowrap;
}

.hsp-delta {
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

.hsp-delta.pos { color: #6ee7b7; }
.hsp-delta.neg { color: #fca5a5; }

/* Notes text row */
.hsp-notes {
    margin-top: 0.28rem;
    font-size: 0.68rem;
    color: var(--text-secondary);
    line-height: 1.38;
    opacity: 0.85;
}

.holding-support-panel-tax {
    border-left: 2px solid rgba(245, 158, 11, 0.32);
}

.holding-support-panel-tax.tone-risk {
    border-left-color: rgba(239, 68, 68, 0.34);
}

.holding-support-panel-tax.tone-good {
    border-left-color: rgba(16, 185, 129, 0.32);
}

.holding-support-panel-sector {
    border-left: 2px solid rgba(59, 130, 246, 0.3);
}

.holding-support-panel-replacement {
    border-left: 2px solid rgba(148, 163, 184, 0.3);
}

.holding-support-panel-replacement.tone-risk {
    border-left-color: rgba(239, 68, 68, 0.32);
}

.holding-support-panel-replacement.tone-good {
    border-left-color: rgba(16, 185, 129, 0.3);
}

.portfolio-page .holding-main-cell {
    padding-top: 0.82rem;
    padding-bottom: 0.82rem;
}

.portfolio-page .ticker-line {
    color: var(--text-primary);
    font-size: 0.94rem;
    font-weight: 800;
    letter-spacing: -0.01em;
}

.portfolio-page .holding-subline {
    margin-top: 0.18rem;
    color: var(--text-secondary);
    font-size: 0.72rem;
    line-height: 1.34;
}

.portfolio-page .holding-decision-line {
    margin-top: 0.48rem;
}

.portfolio-page .holding-dividend-summary {
    padding-top: 0;
}

.portfolio-page .holdings-table td.metric-value,
.portfolio-page .holdings-table td.metric-pl {
    font-size: 0.86rem;
    font-weight: 800;
}

.portfolio-page .holdings-table td.metric-amount,
.portfolio-page .holdings-table td.metric-avg,
.portfolio-page .holdings-table td.metric-price,
.portfolio-page .holdings-table td.holding-dividend-cell {
    color: var(--text-secondary);
    font-size: 0.8rem;
}

.portfolio-page .holdings-table tr.holding-row:hover td {
    background: rgba(255, 255, 255, 0.015);
}

.holding-tax-strip {
    display: flex;
    flex-wrap: wrap;
    gap: 0.36rem;
    margin-top: 0.46rem;
}

.holding-tax-chip {
    display: inline-flex;
    align-items: center;
    min-height: 1.7rem;
    padding: 0.22rem 0.56rem;
    border-radius: 999px;
    border: 1px solid rgba(81, 104, 138, 0.28);
    background: rgba(17, 28, 43, 0.92);
    color: #d7e6f8;
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.03em;
    line-height: 1.2;
}

.holding-tax-chip.tone-good {
    border-color: rgba(16, 185, 129, 0.35);
    color: #7ee7be;
}

.holding-tax-chip.tone-warn {
    border-color: rgba(245, 158, 11, 0.35);
    color: #fcd34d;
}

.holding-tax-chip.tone-risk {
    border-color: rgba(239, 68, 68, 0.35);
    color: #fca5a5;
}

.holding-tax-note {
    margin-top: 0.38rem;
    color: var(--text-secondary);
    font-size: 0.74rem;
    line-height: 1.42;
}

.holding-sector-strip {
    display: flex;
    flex-wrap: wrap;
    gap: 0.36rem;
    margin-top: 0.44rem;
}

.holding-sector-chip {
    display: inline-flex;
    align-items: center;
    min-height: 1.7rem;
    padding: 0.22rem 0.56rem;
    border-radius: 999px;
    border: 1px solid rgba(59, 130, 246, 0.24);
    background: rgba(13, 23, 38, 0.92);
    color: #bfdbfe;
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.03em;
    line-height: 1.2;
}

.holding-sector-note {
    margin-top: 0.36rem;
    color: var(--text-secondary);
    font-size: 0.74rem;
    line-height: 1.42;
}

.holding-replacement-strip {
    display: flex;
    flex-wrap: wrap;
    gap: 0.36rem;
    margin-top: 0.42rem;
}

.holding-replacement-chip {
    display: inline-flex;
    align-items: center;
    min-height: 1.7rem;
    padding: 0.22rem 0.56rem;
    border-radius: 999px;
    border: 1px solid rgba(81, 104, 138, 0.28);
    background: rgba(17, 28, 43, 0.92);
    color: #d7e6f8;
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.03em;
    line-height: 1.2;
}

.holding-replacement-chip.tone-good {
    border-color: rgba(16, 185, 129, 0.35);
    color: #7ee7be;
}

.holding-replacement-chip.tone-warn {
    border-color: rgba(245, 158, 11, 0.35);
    color: #fcd34d;
}

.holding-replacement-chip.tone-risk {
    border-color: rgba(239, 68, 68, 0.35);
    color: #fca5a5;
}

.holding-replacement-note {
    margin-top: 0.34rem;
    color: var(--text-secondary);
    font-size: 0.74rem;
    line-height: 1.42;
    max-width: 100%;
    overflow-wrap: anywhere;
}

.portfolio-page .holding-support-panel {
    padding: 0.62rem 0.68rem;
    border-radius: 9px;
    background: rgba(8, 14, 26, 0.18);
}

.portfolio-page .holding-support-panel-replacement .holding-replacement-strip {
    gap: 0.28rem;
}

.portfolio-page .holding-support-panel-replacement .holding-replacement-chip {
    padding: 0.16rem 0.4rem;
    font-size: 0.64rem;
}

.portfolio-page .holding-support-panel .holding-tax-strip,
.portfolio-page .holding-support-panel .holding-sector-strip,
.portfolio-page .holding-support-panel .holding-replacement-strip {
    margin-top: 0;
}

.portfolio-page .holding-tax-chip,
.portfolio-page .holding-sector-chip,
.portfolio-page .holding-replacement-chip {
    min-height: 1.42rem;
    padding: 0.12rem 0.42rem;
    font-size: 0.62rem;
    font-weight: 700;
    background: rgba(255, 255, 255, 0.02);
}

.portfolio-page .holding-tax-note,
.portfolio-page .holding-sector-note,
.portfolio-page .holding-replacement-note {
    margin-top: 0.24rem;
    color: var(--text-secondary);
    font-size: 0.69rem;
    line-height: 1.36;
}

.portfolio-page .action-stack .badge-mini,
.portfolio-page .action-stack .action-btn {
    min-height: 28px;
    padding: 0.2rem 0.46rem;
    font-size: 0.66rem;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.012);
    border-color: rgba(81, 104, 138, 0.16);
    color: #d7e3f5;
    font-weight: 650;
}

.portfolio-page .action-stack .history-btn:hover,
.portfolio-page .action-stack .sell-btn:hover,
.portfolio-page .action-stack .move-open-btn:hover {
    background: rgba(255, 255, 255, 0.04);
}

.portfolio-page .holdings-table thead th {
    padding-top: 0.74rem;
    padding-bottom: 0.74rem;
    color: #8ea6c3;
    background: rgba(255, 255, 255, 0.015);
}

.portfolio-page .holdings-table td {
    padding-top: 0.86rem;
    padding-bottom: 0.86rem;
}

.portfolio-page .holdings-table tr.holding-row:hover + .holding-support-row td.holding-support-cell {
    background: rgba(255, 255, 255, 0.018);
}

.holding-quick-fact {
    display: flex;
    flex-direction: column;
    gap: 0.14rem;
    min-width: 0;
    padding: 0.45rem 0.5rem;
    border-radius: 9px;
    border: 1px solid rgba(51, 89, 127, 0.24);
    background: rgba(255,255,255,0.03);
}

.holding-quick-fact-label {
    font-size: 0.62rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--text-muted);
    line-height: 1.2;
}

.holding-quick-fact-value {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.stock-signal-summary {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.75rem;
    margin-top: 1rem;
}

.stock-summary-item {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    padding: 0.95rem 1rem;
    border-radius: 14px;
    border: 1px solid rgba(51, 89, 127, 0.3);
    background: rgba(255, 255, 255, 0.02);
}

.stock-summary-item span {
    color: var(--text-muted);
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    font-weight: 800;
}

.stock-summary-item strong {
    color: var(--text-primary);
    font-size: 0.94rem;
    line-height: 1.35;
}

.stock-summary-item small {
    color: var(--text-secondary);
    font-size: 0.78rem;
    line-height: 1.45;
}

.listing-quick-facts {
    display: none;
}

.stock-insights-grid {
    gap: 1rem;
}

.stock-insight-card {
    padding: 1.15rem;
}

.stock-detail-actions {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
    margin: 1rem 0 1.5rem;
}

.stock-decision-actions {
    margin: 1rem 0 0;
}

.stock-decision-actions .btn-primary,
.stock-decision-actions .btn-secondary {
    min-width: 190px;
}

.stock-facts-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.5rem;
}

.stock-fact-card {
    border: 1px solid rgba(51, 89, 127, 0.28);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.02);
    padding: 0.7rem 0.75rem;
}

.stock-fact-card span {
    display: block;
    color: var(--text-muted);
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-weight: 800;
}

.stock-fact-card strong {
    display: block;
    margin-top: 0.22rem;
    color: var(--text-primary);
    font-size: 0.92rem;
    line-height: 1.35;
}

.portfolio-priority-banner,
.public-portfolio-priority {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 0.7rem;
    align-items: start;
    padding: 0.82rem 0.92rem;
    margin: 0 0 0.82rem;
    border-radius: 14px;
    border: 1px solid rgba(51, 89, 127, 0.34);
    background: linear-gradient(180deg, rgba(11, 21, 35, 0.9), rgba(9, 17, 29, 0.96));
    box-shadow: none;
}

.portfolio-priority-banner.tone-good,
.public-portfolio-priority.tone-good {
    border-color: rgba(16, 185, 129, 0.3);
}

.portfolio-priority-banner.tone-warn,
.public-portfolio-priority.tone-warn {
    border-color: rgba(245, 158, 11, 0.28);
}

.portfolio-priority-banner.tone-risk,
.public-portfolio-priority.tone-risk {
    border-color: rgba(239, 68, 68, 0.28);
}

.portfolio-priority-copy,
.public-portfolio-priority-copy {
    min-width: 0;
}

.portfolio-priority-eyebrow,
.public-portfolio-priority-eyebrow {
    display: inline-block;
    margin: 0 0 0.22rem;
    color: var(--text-muted);
    font-size: 0.64rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.portfolio-priority-copy h3,
.public-portfolio-priority-copy h3 {
    margin: 0;
    font-size: 0.96rem;
    color: var(--text-primary);
}

.portfolio-priority-copy p,
.public-portfolio-priority-copy p {
    margin: 0.22rem 0 0;
    color: var(--text-secondary);
    line-height: 1.42;
    max-width: 52rem;
    font-size: 0.86rem;
}

.portfolio-priority-meta,
.public-portfolio-priority-meta {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-start;
    gap: 0.38rem;
    padding-top: 0.08rem;
}

.portfolio-priority-chip,
.public-portfolio-priority-chip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 30px;
    padding: 0.24rem 0.58rem;
    border-radius: 999px;
    border: 1px solid rgba(51, 89, 127, 0.34);
    background: rgba(255,255,255,0.03);
    color: var(--text-primary);
    font-size: 0.72rem;
    font-weight: 650;
}

.dividend-toggle-wrap {
    margin-top: 0.75rem;
}

.split-header .btn-primary,
.split-header form .btn-primary {
    white-space: nowrap;
}

.profile-page .profile-container {
    max-width: 760px;
    margin: 1.35rem auto 2rem;
}

.public-portfolio-header-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.public-portfolio-header-chip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 34px;
    padding: 0.35rem 0.75rem;
    border-radius: 999px;
    border: 1px solid rgba(51, 89, 127, 0.34);
    background: rgba(255, 255, 255, 0.03);
    color: var(--text-primary);
    font-size: 0.76rem;
    font-weight: 700;
}

.public-portfolio-page .top-stats {
    gap: 0.9rem;
    margin-bottom: 0.9rem;
}

.portfolio-page .portfolio-toolbar,
.public-portfolio-page .directory-header.split-header,
.stock-detail-page .stock-detail-header {
    gap: 0.9rem;
}

.public-portfolio-page .table-container,
.public-portfolio-page .chart-container {
    margin-top: 0.9rem;
}

.stock-detail-page .related-sector-section {
    margin-top: 1.35rem;
    padding-top: 1rem;
}

.stock-detail-page .related-sector-title {
    margin: 0 0 0.85rem;
    font-size: 0.9rem;
    color: var(--text-primary);
    letter-spacing: -0.01em;
}

.profile-page .profile-section,
.legal-page .legal-card {
    padding: 1.2rem;
}

.profile-page .profile-section h2,
.legal-page .legal-card h1 {
    font-size: 1.15rem;
    letter-spacing: -0.02em;
}

.profile-page .form-group {
    margin-bottom: 0.9rem;
}

.profile-page .form-group label {
    display: block;
    margin-bottom: 0.38rem;
    color: var(--text-secondary);
    font-size: 0.82rem;
    font-weight: 700;
}

.profile-page .checkbox-group {
    display: flex;
    gap: 0.65rem;
    align-items: center;
    border: 1px solid rgba(51, 89, 127, 0.38);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.02);
    padding: 0.68rem 0.76rem;
    color: var(--text-secondary);
}

.profile-page input[readonly] {
    opacity: 0.82;
    cursor: not-allowed;
}

.profile-page .btn-save,
.profile-page .btn-delete {
    width: 100%;
}

.profile-header {
    margin-bottom: 1rem;
}

.profile-header-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.8rem;
}

.profile-summary-chip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 34px;
    padding: 0.35rem 0.75rem;
    border-radius: 999px;
    border: 1px solid rgba(51, 89, 127, 0.34);
    background: rgba(255, 255, 255, 0.03);
    color: var(--text-primary);
    font-size: 0.76rem;
    font-weight: 700;
}

.profile-section-note {
    margin: 0.25rem 0 0.9rem;
    color: var(--text-secondary);
    font-size: 0.84rem;
    line-height: 1.5;
}

.profile-inline-help {
    display: block;
    margin-top: 0.2rem;
    color: var(--text-muted);
    font-size: 0.78rem;
    font-weight: 500;
    line-height: 1.45;
}

.profile-page .delete-section {
    border-color: rgba(239, 68, 68, 0.3) !important;
    background: linear-gradient(180deg, rgba(73, 22, 22, 0.42), rgba(34, 13, 13, 0.48)) !important;
}

.profile-page .delete-help-text {
    color: var(--text-secondary);
    font-size: 0.84rem;
    line-height: 1.5;
}

.profile-page .alert {
    padding: 0.82rem 0.9rem;
    border-radius: 12px;
    background: rgba(16, 185, 129, 0.12);
    border: 1px solid rgba(16, 185, 129, 0.26);
    color: #c9f7df;
    margin-bottom: 0.85rem;
}

.legal-intro {
    display: grid;
    gap: 0.45rem;
    margin-bottom: 0.9rem;
}

.legal-kicker {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: fit-content;
    min-height: 28px;
    padding: 0.2rem 0.6rem;
    border-radius: 999px;
    border: 1px solid rgba(120, 179, 255, 0.28);
    background: rgba(120, 179, 255, 0.1);
    color: #dce8f8;
    font-size: 0.7rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.legal-summary {
    margin: 0;
    color: var(--text-secondary);
    max-width: 52rem;
    line-height: 1.6;
}

.main-footer {
    margin-top: 4rem !important;
    padding: 3.2rem 0 2rem !important;
    background: #05101c !important;
    border-top: 1px solid rgba(51, 89, 127, 0.28);
}

.footer-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.2fr) repeat(2, minmax(0, 0.9fr));
    gap: 1rem;
}

.f-col {
    padding: 1.2rem;
    border-radius: 18px;
    border: 1px solid rgba(51, 89, 127, 0.28);
    background: rgba(10, 19, 31, 0.82);
}

.disclaimer-box {
    margin-top: 1rem;
    padding: 1rem 1.15rem;
    border-radius: 16px;
    border: 1px solid rgba(51, 89, 127, 0.28);
    background: rgba(10, 19, 31, 0.72);
}

@media (max-width: 900px) {
    header {
        position: sticky;
        top: 0;
    }

    .header-inner {
        display: grid !important;
        grid-template-columns: minmax(0, 1fr) auto auto !important;
        min-height: 64px !important;
        gap: 0.6rem !important;
        padding: 0 0.85rem !important;
    }

    .mobile-top-actions {
        display: inline-flex;
        justify-self: end;
        gap: 0.45rem !important;
        margin-right: 0 !important;
    }

    .mobile-menu-toggle,
    .mobile-auth-shortcut,
    .mobile-lang-shortcut {
        backdrop-filter: none !important;
        box-shadow: none !important;
    }

    .mobile-menu-toggle {
        width: 42px;
        height: 42px;
        border-radius: 12px !important;
        border: 1px solid rgba(51, 89, 127, 0.44) !important;
        background: rgba(12, 24, 39, 0.96) !important;
    }

    .main-nav {
        width: min(92vw, 340px) !important;
        max-width: min(92vw, 340px) !important;
        margin: 0 !important;
        padding: 0.95rem 0.9rem 1rem !important;
        background: linear-gradient(180deg, #08121f 0%, #0d1b2e 100%) !important;
        border-left: 1px solid rgba(103, 136, 176, 0.42) !important;
        box-shadow: -22px 0 46px rgba(0, 0, 0, 0.42) !important;
        color: #f8fbff !important;
        backdrop-filter: none !important;
        clip-path: none !important;
        opacity: 1 !important;
        transform: translateX(100%) !important;
        visibility: hidden !important;
        pointer-events: none !important;
        transition: transform 0.22s ease, visibility 0s linear 0.22s !important;
    }

    .main-nav.active {
        transform: translateX(0) !important;
        visibility: visible !important;
        pointer-events: auto !important;
        transition: transform 0.22s ease !important;
    }

    .mobile-nav-overlay {
        background: rgba(3, 10, 18, 0.62) !important;
        backdrop-filter: none !important;
    }

    .nav-mobile-head {
        position: static !important;
        background: transparent !important;
        padding-top: 0 !important;
        margin: 0 0 0.6rem !important;
    }

    .nav-mobile-title {
        color: #f8fbff !important;
        font-weight: 800 !important;
        letter-spacing: 0.12em !important;
    }

    .nav-mobile-section-label {
        color: #9fb6d2 !important;
    }

    .nav-mobile-close {
        color: #e9f2fb !important;
        border-color: rgba(116, 149, 190, 0.34) !important;
        background: rgba(255, 255, 255, 0.04) !important;
    }

    .nav-mobile-close:hover {
        color: #ffffff !important;
        border-color: rgba(160, 196, 255, 0.56) !important;
        background: rgba(120, 179, 255, 0.12) !important;
    }

    .nav-mobile-auth .nav-mobile-auth-btn {
        background: #edf4fc !important;
        border-color: #d7e6f6 !important;
        color: #081321 !important;
        font-weight: 800 !important;
    }

    .nav-mobile-auth .nav-mobile-auth-btn:hover {
        background: #ffffff !important;
        border-color: #ffffff !important;
        color: #081321 !important;
    }

    .nav-link {
        width: 100%;
        min-height: 48px !important;
        justify-content: flex-start;
        border-radius: 14px !important;
        background: rgba(255, 255, 255, 0.045) !important;
        border: 1px solid rgba(103, 136, 176, 0.26) !important;
        color: #e6eef8 !important;
    }

    .nav-link-text {
        color: inherit !important;
        font-weight: 700 !important;
    }

    .nav-link-icon {
        color: #9fc8ff !important;
    }

    .nav-link:hover {
        color: #ffffff !important;
        background: rgba(120, 179, 255, 0.12) !important;
        border-color: rgba(120, 179, 255, 0.38) !important;
    }

    .nav-link.active {
        color: #ffffff !important;
        background: linear-gradient(180deg, rgba(120, 179, 255, 0.18), rgba(120, 179, 255, 0.1)) !important;
        border-color: rgba(120, 179, 255, 0.52) !important;
    }

    .nav-link.active .nav-link-icon {
        color: #ffffff !important;
    }

    .nav-utils,
    .nav-mobile-auth,
    .header-stock-search,
    .lang-switcher {
        width: 100%;
    }

    .header-stock-search input {
        background: rgba(6, 15, 26, 0.96) !important;
        border-color: rgba(103, 136, 176, 0.32) !important;
        color: #f8fbff !important;
    }

    .header-stock-search input::placeholder {
        color: #93a9c4 !important;
        opacity: 1;
    }

    .header-search-icon {
        color: #9fb6d2 !important;
    }

    .lang-switcher {
        border-color: rgba(103, 136, 176, 0.32) !important;
        background: rgba(255, 255, 255, 0.05) !important;
    }

    .lang-switcher .divider {
        color: #6f88a8 !important;
    }

    .lang-switcher a {
        color: #d5e2f1 !important;
    }

    .lang-switcher a.active {
        color: #081321 !important;
        background: #edf4fc !important;
        box-shadow: none !important;
    }

    .mobile-dock,
    .mobile-dock.is-authenticated,
    .mobile-dock.is-guest {
        left: 0.75rem !important;
        right: 0.75rem !important;
        bottom: max(0.75rem, env(safe-area-inset-bottom)) !important;
        padding: 0.32rem !important;
        border-radius: 16px !important;
        border: 1px solid rgba(51, 89, 127, 0.38) !important;
        background: rgba(8, 18, 31, 0.98) !important;
        box-shadow: 0 16px 34px rgba(0, 0, 0, 0.28) !important;
        backdrop-filter: none !important;
    }

    .mobile-dock-link {
        min-height: 56px !important;
        border-radius: 12px !important;
        padding: 0.34rem 0.2rem !important;
    }

    .directory-header.split-header,
    .home-v2-hero,
    .home-v2-conversion,
    .home-v2-sections,
    .home-v2-trust-list,
    .home-v2-focus-grid,
    .profile-header-meta,
    .home-v2-conversion-metrics,
    .stock-decision-hero,
    .stock-signal-summary,
    .entry-conversion-metrics,
    .stock-trust-stats,
    .stock-insights-grid,
    .footer-grid {
        grid-template-columns: 1fr !important;
        display: grid;
    }

    .directory-header,
    .home-v2-hero,
    .home-v2-conversion,
    .home-v2-block,
    .entry-conversion,
    .stock-insight-card,
    .table-container,
    .chart-container,
    .profile-page .profile-section,
    .legal-page .legal-card {
        padding: 1rem !important;
        border-radius: 16px !important;
    }

    .home-v2-actions,
    .entry-conversion-actions,
    .stock-detail-actions {
        display: grid !important;
        grid-template-columns: 1fr !important;
        gap: 0.6rem !important;
    }

    .public-portfolio-header-meta {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 0.45rem;
    }

    .home-v2-actions .btn-primary,
    .home-v2-actions .btn-secondary,
    .entry-conversion-actions .btn-primary,
    .entry-conversion-actions .btn-secondary,
    .split-header .btn-primary,
    .split-header form .btn-primary {
        width: 100%;
        min-width: 0;
    }

    .directory-header .subtitle,
    .home-v2-subtitle,
    .home-v2-note,
    .entry-conversion-copy p,
    .public-portfolio-page .directory-header .subtitle,
    .stock-detail-page .directory-header .subtitle {
        font-size: 0.9rem;
    }

    .companies-page .letter-filter {
        flex-wrap: nowrap;
        overflow-x: auto;
        padding-bottom: 0.2rem;
        -webkit-overflow-scrolling: touch;
    }

    .companies-page .letter-chip {
        flex: 0 0 auto;
    }

    .market-table,
    .market-table tbody,
    .market-table tr,
    .social-table,
    .social-table tbody,
    .social-table tr,
    .public-holdings-table,
    .public-holdings-table tbody,
    .public-holdings-table tr {
        display: block;
        width: 100%;
    }

    .market-table thead,
    .social-table thead,
    .public-holdings-table thead {
        display: none;
    }

    .market-table tr,
    .social-table tr,
    .public-holdings-table tr {
        margin-bottom: 0.75rem;
        border: 1px solid rgba(51, 89, 127, 0.3);
        border-radius: 16px;
        overflow: hidden;
        background: rgba(255, 255, 255, 0.02);
    }

    .market-table td,
    .social-table td,
    .public-holdings-table td {
        display: grid !important;
        grid-template-columns: minmax(84px, 104px) minmax(0, 1fr) !important;
        gap: 0.24rem 0.75rem !important;
        align-items: start !important;
        padding: 0.8rem 0.9rem !important;
        border-bottom: 1px solid rgba(51, 89, 127, 0.2) !important;
        text-align: left !important;
    }

    .market-table td:last-child,
    .social-table td:last-child,
    .public-holdings-table td:last-child {
        border-bottom: 0 !important;
    }

    .market-table td::before,
    .social-table td::before,
    .public-holdings-table td::before {
        content: attr(data-label);
        color: var(--text-muted) !important;
        font-size: 0.68rem !important;
        font-weight: 800 !important;
        text-transform: uppercase;
        letter-spacing: 0.06em;
    }

    .market-table td .cell-value,
    .social-table td .cell-value,
    .public-holdings-table td .cell-value {
        display: inline-flex;
        align-items: center;
        justify-content: flex-start;
        gap: 0.45rem;
        min-width: 0;
    }

    .market-table td.text-right .cell-value,
    .social-table td.text-right .cell-value,
    .public-holdings-table td.text-right .cell-value,
    .public-holdings-table td.text-right > *:not(::before) {
        justify-content: flex-end !important;
        text-align: right;
        margin-left: auto;
    }

    .social-actions {
        justify-content: flex-start;
    }

    .holding-decision-line {
        margin-top: 0.45rem;
    }

    .holding-decision-line .signal-badge,
    .holding-decision-line .holding-return-chip {
        min-height: 30px;
        font-size: 0.74rem;
    }

    .listing-quick-facts {
        display: grid;
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 0.4rem;
        margin-top: 0.6rem;
    }

    .totals-mode-toggle {
        width: 100%;
        justify-content: space-between;
    }

    .totals-mode-label {
        padding-right: 0;
    }

    .totals-mode-btn {
        flex: 1;
        min-height: 40px;
        padding: 0.44rem 0.5rem;
        font-size: 0.8rem;
    }

    .holding-dividend-cell {
        min-width: 0;
    }

    .holding-dividend-summary {
        align-items: flex-start;
    }

    .holding-quick-facts {
        display: grid;
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 0.45rem;
        margin-top: 0.7rem;
    }

    .portfolio-priority-banner,
    .public-portfolio-priority {
        grid-template-columns: 1fr;
        padding: 0.95rem;
    }

    .portfolio-priority-meta,
    .public-portfolio-priority-meta {
        justify-content: flex-start;
    }

    .listing-quick-fact {
        display: flex;
        flex-direction: column;
        gap: 0.12rem;
        min-width: 0;
        padding: 0.42rem 0.48rem;
        border-radius: 9px;
        border: 1px solid rgba(51, 89, 127, 0.24);
        background: rgba(255, 255, 255, 0.03);
    }

    .listing-quick-fact-label {
        color: var(--text-muted);
        font-size: 0.6rem;
        text-transform: uppercase;
        letter-spacing: 0.06em;
        font-weight: 800;
        line-height: 1.2;
    }

    .listing-quick-fact-value {
        color: var(--text-primary);
        font-size: 0.78rem;
        font-weight: 700;
        line-height: 1.3;
        min-width: 0;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .market-directory-page .market-cell-signal,
    .market-directory-page .market-cell-score,
    .market-directory-page .market-cell-price,
    .companies-page .company-cell-sector,
    .social-page .social-cell-holdings,
    .social-page .social-cell-followers,
    .social-page .social-cell-return {
        display: none !important;
    }

    .market-directory-page .market-table td.name-cell .company-name,
    .companies-page .market-table td.name-cell .company-name {
        display: block;
    }

    .social-page .social-table td:first-child strong {
        display: block;
    }

    .stock-facts-grid {
        grid-template-columns: 1fr 1fr;
    }

    .stock-trust-stats {
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    }

    .profile-page .profile-container {
        margin: 1rem auto 1.5rem;
    }
}

@media (max-width: 640px) {
    .directory-header h1,
    .stock-detail-page .directory-header h1,
    .portfolio-page .directory-header h1,
    .public-portfolio-page .directory-header h1 {
        font-size: clamp(1.55rem, 8vw, 2rem) !important;
    }

    .market-table td,
    .social-table td,
    .public-holdings-table td {
        grid-template-columns: minmax(72px, 90px) minmax(0, 1fr) !important;
        padding: 0.72rem 0.78rem !important;
    }

    .listing-quick-facts,
    .stock-facts-grid,
    .holding-quick-facts {
        grid-template-columns: 1fr !important;
    }

    .public-portfolio-header-meta {
        grid-template-columns: 1fr;
    }

    .footer-grid {
        gap: 0.75rem;
    }
}

@media (max-width: 900px) {
    .companies-page .market-table td:first-child strong,
    .social-page .social-table td:first-child strong {
        font-size: 0.98rem;
        line-height: 1.25;
    }

    .companies-page .market-table td.name-cell,
    .social-page .social-table td:first-child {
        padding-top: 0.8rem !important;
        padding-bottom: 0.8rem !important;
    }

    .companies-page .listing-quick-facts,
    .social-page .listing-quick-facts {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 0.35rem;
        margin-top: 0.55rem;
    }

    .companies-page .listing-quick-fact,
    .social-page .listing-quick-fact {
        padding: 0.34rem 0.42rem;
        border-radius: 10px;
    }

    .companies-page .listing-quick-fact-label,
    .social-page .listing-quick-fact-label {
        font-size: 0.62rem;
    }

    .companies-page .listing-quick-fact-value,
    .social-page .listing-quick-fact-value {
        font-size: 0.8rem;
        line-height: 1.3;
    }

    .social-page .portfolio-risk-label {
        display: inline-flex;
        align-items: center;
        margin-top: 0.4rem;
        margin-bottom: 0.15rem;
    }

    .social-page .social-actions-cell {
        padding-top: 0.55rem !important;
        border-top: 1px solid rgba(92, 116, 147, 0.18);
    }

    .social-page .social-actions {
        gap: 0.4rem;
    }
}

@media (max-width: 640px) {
    .companies-page .listing-quick-facts,
    .social-page .listing-quick-facts {
        grid-template-columns: 1fr 1fr !important;
    }

    .companies-page .listing-quick-fact,
    .social-page .listing-quick-fact {
        min-height: 0;
    }

    .social-page .social-actions-cell {
        padding-top: 0.6rem !important;
    }
}

@media (max-width: 900px) {
    .stock-detail-page .stock-detail-header {
        display: grid;
        gap: 0.72rem;
    }

    .stock-detail-page .stock-decision-hero {
        order: 1;
        gap: 0.55rem;
    }

    .stock-detail-page .stock-decision-actions {
        order: 2;
        margin: 0;
    }

    .stock-detail-page .stock-signal-summary {
        order: 3;
        margin-top: 0;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 0.5rem;
    }

    .stock-detail-page .stock-summary-item {
        padding: 0.72rem 0.78rem;
        border-radius: 12px;
        gap: 0.18rem;
    }

    .stock-detail-page .stock-summary-item:last-child {
        grid-column: 1 / -1;
    }

    .stock-detail-page .stock-summary-item span {
        font-size: 0.64rem;
    }

    .stock-detail-page .stock-summary-item strong {
        font-size: 0.88rem;
        line-height: 1.32;
    }

    .stock-detail-page .stock-summary-item small {
        font-size: 0.72rem;
        line-height: 1.35;
        display: -webkit-box;
        -webkit-box-orient: vertical;
        -webkit-line-clamp: 2;
        overflow: hidden;
    }

    .stock-detail-page .stock-insights-grid {
        margin-top: 0.6rem;
    }
}

/* Shared shell width: keep every public page on the same desktop measure */
:root {
    --site-shell-max-width: 1240px;
}

.container,
.header-inner {
    max-width: var(--site-shell-max-width) !important;
}

.home-page .home-v2-hero,
.home-page .home-v2-conversion,
.home-page .home-v2-sections,
.market-directory-page .directory-header,
.market-directory-page .entry-conversion,
.market-directory-page .table-container,
.companies-page .directory-header,
.companies-page .entry-conversion,
.companies-page .table-container,
.social-page .directory-header,
.social-page .entry-conversion,
.social-page .table-container,
.social-page .social-table-container,
.public-portfolio-page .directory-header,
.public-portfolio-page .top-stats,
.public-portfolio-page .chart-container,
.public-portfolio-page .public-holdings-container,
.public-portfolio-page .portfolio-income-section,
.stock-detail-page .directory-header,
.stock-detail-page .stock-insights-grid,
.stock-detail-page .related-stock-grid,
.portfolio-page .directory-header,
.portfolio-page .portfolio-layout,
.portfolio-page .portfolio-toolbar,
.portfolio-page .top-stats,
.portfolio-page .estimate-section,
.portfolio-page .optimizer-section,
.portfolio-page .charts-grid,
.portfolio-page .holdings-container,
.portfolio-page .export-section,
.portfolio-page .import-section,
.portfolio-page .portfolio-income-section,
.profile-page .profile-container,
.legal-page .legal-card {
    width: 100% !important;
    max-width: var(--site-shell-max-width) !important;
    box-sizing: border-box;
    margin-left: auto !important;
    margin-right: auto !important;
}

.profile-page .profile-container {
    margin-top: 1.35rem;
    margin-bottom: 2rem;
}

@media (max-width: 900px) {
    .home-page .home-v2-hero,
    .home-page .home-v2-conversion,
    .home-page .home-v2-sections,
    .market-directory-page .directory-header,
    .market-directory-page .entry-conversion,
    .market-directory-page .table-container,
    .companies-page .directory-header,
    .companies-page .entry-conversion,
    .companies-page .table-container,
    .social-page .directory-header,
    .social-page .entry-conversion,
    .social-page .table-container,
    .social-page .social-table-container,
    .public-portfolio-page .directory-header,
    .public-portfolio-page .top-stats,
    .public-portfolio-page .chart-container,
    .public-portfolio-page .public-holdings-container,
    .public-portfolio-page .portfolio-income-section,
    .stock-detail-page .directory-header,
    .stock-detail-page .stock-insights-grid,
    .stock-detail-page .related-stock-grid,
    .portfolio-page .directory-header,
    .portfolio-page .portfolio-layout,
    .portfolio-page .portfolio-toolbar,
    .portfolio-page .top-stats,
    .portfolio-page .estimate-section,
    .portfolio-page .optimizer-section,
    .portfolio-page .charts-grid,
    .portfolio-page .holdings-container,
    .portfolio-page .export-section,
    .portfolio-page .import-section,
    .portfolio-page .portfolio-income-section,
    .profile-page .profile-container,
    .legal-page .legal-card {
        max-width: 100% !important;
    }
}

/* Final panel normalization: keep portfolio, public portfolio, footer, and utility pages on one rhythm */
.portfolio-page .top-stats,
.public-portfolio-page .top-stats {
    align-items: stretch;
}

.portfolio-page .top-stats-primary,
.portfolio-page .top-stats-secondary,
.public-portfolio-page .top-stats-primary,
.public-portfolio-page .top-stats-secondary {
    display: grid;
    gap: 0.75rem;
}

.portfolio-page .top-stats-primary,
.public-portfolio-page .top-stats-primary {
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

.portfolio-page .top-stats-secondary,
.public-portfolio-page .top-stats-secondary {
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
    margin-top: 0.75rem;
}

.portfolio-page .eval-panel,
.portfolio-page .value-panel,
.public-portfolio-page .eval-panel,
.public-portfolio-page .value-panel {
    min-height: 0;
    min-width: 0;
    padding: 1.18rem !important;
    border-radius: 18px !important;
    text-align: left !important;
    overflow: hidden;
}

.portfolio-page .eval-panel,
.public-portfolio-page .eval-panel {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 0.22rem;
}

.portfolio-page .value-panel,
.public-portfolio-page .value-panel {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 0.22rem;
}

.portfolio-page .eval-score,
.public-portfolio-page .eval-score {
    line-height: 1;
    margin: 0.15rem 0;
}

.portfolio-page .value-amount,
.public-portfolio-page .value-amount {
    line-height: 1.05;
    margin: 0.15rem 0;
    min-width: 0;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.portfolio-page .eval-status,
.portfolio-page .value-meta-note,
.portfolio-page .detail-chip-row,
.portfolio-page .detail-chip,
.portfolio-page .summary-card .meta,
.portfolio-page .summary-card .label,
.portfolio-page .summary-card .value,
.portfolio-page .eval-panel p,
.portfolio-page .value-panel p {
    min-width: 0;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.portfolio-page .portfolio-toolbar,
.public-portfolio-page .directory-header.split-header {
    margin-bottom: 1rem;
}

.portfolio-page .portfolio-toolbar,
.portfolio-page .estimate-section,
.portfolio-page .optimizer-suggestions,
.portfolio-page .chart-container,
.portfolio-page .holdings-container,
.portfolio-page .export-section,
.portfolio-page .import-section,
.portfolio-page .portfolio-income-section,
.public-portfolio-page .portfolio-income-section,
.public-portfolio-page .public-holdings-container,
.public-portfolio-page .chart-container {
    margin-top: 1rem;
}

.portfolio-page .portfolio-income-section,
.public-portfolio-page .portfolio-income-section {
    padding: 0;
    background: transparent !important;
    border: 0 !important;
    box-shadow: none !important;
}

.portfolio-page .dividend-summary-grid,
.public-portfolio-page .dividend-summary-grid {
    gap: 0.75rem;
}

.portfolio-page .dividend-summary-card,
.public-portfolio-page .dividend-summary-card {
    min-height: 132px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 0.2rem;
    padding: 1rem 1.05rem !important;
    border-radius: 16px !important;
}

.portfolio-page .dividend-event-list,
.portfolio-page .dividend-history-dropdown,
.public-portfolio-page .dividend-event-list,
.public-portfolio-page .dividend-history-dropdown {
    margin-top: 0.75rem;
    border-radius: 16px !important;
}

.portfolio-page .chart-container,
.public-portfolio-page .chart-container {
    padding: 1.1rem !important;
}

.portfolio-page .is-secondary-stat {
    min-height: 0;
    padding: 0.92rem 1rem !important;
    border-radius: 15px !important;
    background: rgba(8, 16, 29, 0.48) !important;
}

.portfolio-page .is-secondary-stat .value-amount {
    font-size: 1.22rem;
}

.portfolio-page .is-secondary-stat .value-meta-note {
    font-size: 0.76rem;
}

.portfolio-page .holdings-container,
.public-portfolio-page .public-holdings-container {
    overflow: hidden;
}

.portfolio-page .sidebar h3,
.portfolio-page .optimizer-title,
.portfolio-page .estimate-title,
.portfolio-page .chart-title,
.portfolio-page .export-title,
.public-portfolio-page .panel-eyebrow,
.public-portfolio-page .stat-eyebrow {
    font-size: 0.68rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    font-weight: 800;
}

.main-footer {
    margin-top: 3.2rem !important;
    padding: 2.8rem 0 1.8rem !important;
}

.footer-grid {
    gap: 0.9rem;
}

.f-col {
    padding: 1rem 1.05rem;
    min-height: 100%;
}

.f-col h4 {
    margin-bottom: 0.9rem;
    font-size: 0.92rem;
    letter-spacing: -0.01em;
}

.f-col p,
.f-col a,
.disclaimer-box {
    font-size: 0.82rem;
    line-height: 1.55;
}

.f-col ul,
.f-col nav,
.f-col .footer-links {
    display: grid;
    gap: 0.45rem;
}

.disclaimer-box {
    margin-top: 0.9rem;
    padding: 0.9rem 1rem;
}

.legal-page .legal-card,
.unsubscribe-page .unsubscribe-card,
.profile-page .profile-section {
    padding: 1.15rem !important;
}

.legal-page .legal-card section {
    padding-top: 0.9rem;
    margin-top: 0.9rem;
}

.legal-page .legal-card p,
.unsubscribe-page .unsubscribe-card p,
.profile-page .profile-section p {
    line-height: 1.58;
}

@media (max-width: 900px) {
    .portfolio-page .eval-panel,
    .portfolio-page .value-panel,
    .public-portfolio-page .eval-panel,
    .public-portfolio-page .value-panel {
        min-height: 0;
        padding: 1rem !important;
    }

    .portfolio-page .dividend-summary-card,
    .public-portfolio-page .dividend-summary-card {
        min-height: 0;
    }

    .main-footer {
        margin-top: 2.4rem !important;
        padding: 2.1rem 0 1.35rem !important;
    }

    .f-col,
    .disclaimer-box {
        padding: 0.95rem 1rem;
    }
}

/* Portfolio page shared structure */
.portfolio-page .portfolio-layout {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 2rem;
    margin-top: 2rem;
}

.portfolio-page .content {
    min-width: 0;
}

.portfolio-page .sidebar {
    background: rgba(8, 16, 30, 0.34);
    border-radius: 14px;
    padding: 1rem;
    border: 1px solid rgba(92, 116, 147, 0.32);
    align-self: start;
    position: sticky;
    top: 88px;
}

/* === Sidebar header === */
.portfolio-page .sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.78rem;
    padding: 0 0.1rem;
}

.portfolio-page .sidebar-label {
    font-size: 0.6rem;
    font-weight: 800;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--text-muted);
}

.portfolio-page .sidebar-count {
    font-size: 0.6rem;
    font-weight: 700;
    color: var(--text-muted);
    background: rgba(255,255,255,0.05);
    padding: 0.1rem 0.38rem;
    border-radius: 999px;
    border: 1px solid rgba(100, 116, 139, 0.18);
    line-height: 1.4;
}

/* === Portfolio nav item === */
.portfolio-page .p-nav-item {
    display: block;
    padding: 0.62rem 0.78rem 0.62rem 0.86rem;
    border-radius: 8px;
    color: var(--text-secondary);
    text-decoration: none;
    margin-bottom: 0.34rem;
    border: 1px solid rgba(92, 116, 147, 0.2);
    border-left: 2px solid rgba(92, 116, 147, 0.2);
    background: rgba(255,255,255,0.016);
}

.portfolio-page .p-nav-item:hover {
    background: rgba(255,255,255,0.032);
    border-color: rgba(92, 116, 147, 0.38);
    border-left-color: rgba(92, 116, 147, 0.38);
}

.portfolio-page .p-nav-item.active {
    background: rgba(57, 194, 255, 0.07);
    border-color: rgba(57, 194, 255, 0.18);
    border-left-color: rgba(57, 194, 255, 0.65);
}

/* Portfolio name line */
.portfolio-page .p-nav-name {
    font-size: 0.86rem;
    font-weight: 700;
    color: var(--text-secondary);
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.portfolio-page .p-nav-item.active .p-nav-name {
    color: #cceeff;
}

/* Meta row: risk + tax badges */
.portfolio-page .p-nav-meta {
    display: flex;
    align-items: center;
    gap: 0.26rem;
    flex-wrap: wrap;
    margin-top: 0.3rem;
}

.portfolio-page .p-risk-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.08rem 0.36rem;
    border-radius: 999px;
    font-size: 0.58rem;
    font-weight: 700;
    letter-spacing: 0.03em;
    border: 1px solid rgba(100, 116, 139, 0.22);
    background: rgba(255,255,255,0.03);
    color: var(--text-muted);
    line-height: 1.4;
}

.portfolio-page .p-risk-badge.risk-low {
    background: rgba(16, 185, 129, 0.1);
    border-color: rgba(16, 185, 129, 0.26);
    color: #6ee7b7;
}

.portfolio-page .p-risk-badge.risk-medium {
    background: rgba(245, 158, 11, 0.1);
    border-color: rgba(245, 158, 11, 0.26);
    color: #fcd34d;
}

.portfolio-page .p-risk-badge.risk-high {
    background: rgba(239, 68, 68, 0.1);
    border-color: rgba(239, 68, 68, 0.26);
    color: #fca5a5;
}

.portfolio-page .p-tax-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.08rem 0.36rem;
    border-radius: 999px;
    font-size: 0.58rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    background: rgba(255,255,255,0.03);
    border: 1px solid rgba(100, 116, 139, 0.18);
    color: var(--text-muted);
    line-height: 1.4;
}

/* Create portfolio button */
.portfolio-page .create-p-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.36rem;
    width: 100%;
    padding: 0.62rem;
    margin-top: 0.62rem;
    background: transparent;
    border: 1px dashed rgba(57, 194, 255, 0.18);
    color: var(--text-muted);
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.76rem;
    text-align: center;
    text-decoration: none;
    box-sizing: border-box;
    line-height: 1;
}

.portfolio-page .create-p-plus {
    font-size: 1rem;
    font-weight: 300;
    line-height: 1;
    opacity: 0.55;
}

.portfolio-page .top-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 0.72rem;
    margin-bottom: 0.78rem;
}

.portfolio-page .eval-panel,
.portfolio-page .value-panel {
    background: linear-gradient(180deg, rgba(12, 23, 38, 0.94), rgba(9, 17, 29, 0.98));
    border: 1px solid rgba(60, 88, 118, 0.36);
    box-shadow: none;
}

.portfolio-page .eval-status {
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--text-secondary);
    margin: 0 0 0.22rem;
}

.portfolio-page .value-amount {
    font-size: 1.58rem;
    font-weight: 800;
    color: var(--text-primary);
}

.portfolio-page .estimate-section {
    margin: 0 0 0.72rem;
    background: rgba(255,255,255,0.01);
    border: 1px solid rgba(92, 116, 147, 0.28);
    border-radius: 11px;
    padding: 0.64rem;
}

.portfolio-page .estimate-header {
    margin: 0 0 0.52rem;
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 0.52rem;
}

.portfolio-page .estimate-title {
    margin: 0;
    font-size: 0.7rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.09em;
}

.portfolio-page .estimate-note {
    margin: 0;
    font-size: 0.7rem;
    color: var(--text-secondary);
}

.portfolio-page .estimate-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 0.45rem;
}

.portfolio-page .estimate-card {
    border: 1px solid rgba(92, 116, 147, 0.28);
    border-left: 2px solid rgba(127, 148, 177, 0.56);
    border-radius: 8px;
    padding: 0.42rem 0.5rem;
    background: rgba(255,255,255,0.005);
}

.portfolio-page .estimate-card .label {
    display: block;
    font-size: 0.62rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.055em;
    margin-bottom: 0.18rem;
}

.portfolio-page .estimate-card .pct {
    display: block;
    font-size: 0.88rem;
    font-weight: 800;
    color: var(--text-primary);
    line-height: 1.2;
}

.portfolio-page .estimate-card .val {
    display: block;
    margin-top: 0.08rem;
    font-size: 0.71rem;
    color: var(--text-secondary);
}

.portfolio-page .estimate-card .cov {
    display: block;
    margin-top: 0.05rem;
    font-size: 0.64rem;
    color: var(--text-muted);
}

.portfolio-page .estimate-card.buy { border-left-color: rgba(16,185,129,0.68); }
.portfolio-page .estimate-card.sell { border-left-color: rgba(239,68,68,0.65); }
.portfolio-page .estimate-card.hold { border-left-color: rgba(245,158,11,0.65); }
.portfolio-page .estimate-card.buy .pct { color: #10b981; }
.portfolio-page .estimate-card.sell .pct { color: #ef4444; }
.portfolio-page .estimate-card.hold .pct { color: #f59e0b; }

.portfolio-page .optimizer-section {
    margin: 0 0 0.8rem;
}

.portfolio-page .holdings-container {
    margin-top: 0.9rem;
    border: 1px solid rgba(60, 88, 118, 0.28);
    border-radius: 16px;
    background: linear-gradient(180deg, rgba(10, 18, 30, 0.84), rgba(8, 14, 24, 0.92));
}

.portfolio-page .holdings-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.7rem;
    padding: 0.88rem 1rem 0.76rem;
    border-bottom: 1px solid rgba(60, 88, 118, 0.24);
}

.portfolio-page .holdings-header-copy {
    min-width: 0;
}

.portfolio-page .holdings-header-copy h3 {
    margin: 0;
    color: var(--text-primary);
    font-size: 0.88rem;
    font-weight: 800;
    letter-spacing: -0.01em;
}

.portfolio-page .holdings-header-copy p {
    display: none;
    margin: 0.2rem 0 0;
    color: var(--text-secondary);
    font-size: 0.74rem;
    line-height: 1.4;
}

.portfolio-page .holdings-header-chip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.9rem;
    min-height: 1.8rem;
    padding: 0.14rem 0.52rem;
    border-radius: 999px;
    border: 1px solid rgba(96, 165, 250, 0.24);
    background: rgba(96, 165, 250, 0.08);
    color: #dce8f8;
    font-size: 0.72rem;
    font-weight: 800;
    line-height: 1;
}

.portfolio-page .holdings-header-meta {
    display: inline-flex;
    align-items: center;
    gap: 0.48rem;
    flex-wrap: wrap;
}

.portfolio-page .holdings-header-chip.tone-warn {
    text-decoration: none;
    border-color: rgba(245, 158, 11, 0.34);
    background: rgba(245, 158, 11, 0.1);
    color: #fbbf24;
}

.portfolio-page .holdings-header-chip.tone-warn:hover {
    filter: brightness(1.06);
}

.portfolio-page .optimizer-title {
    font-size: 0.72rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin: 0 0 0.58rem;
}

.portfolio-page .optimizer-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 0.5rem;
}

.portfolio-page .optimizer-card {
    border: 1px solid rgba(92, 116, 147, 0.28);
    border-left: 2px solid rgba(127, 148, 177, 0.56);
    border-radius: 8px;
    padding: 0.46rem 0.56rem;
    background: rgba(255,255,255,0.005);
}

.portfolio-page .optimizer-card .label {
    display: block;
    font-size: 0.62rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.055em;
    margin-bottom: 0.2rem;
}

.portfolio-page .optimizer-card .value {
    display: block;
    font-size: 0.86rem;
    font-weight: 800;
    color: var(--text-primary);
    line-height: 1.2;
}

.portfolio-page .optimizer-card .detail {
    display: block;
    font-size: 0.68rem;
    color: var(--text-secondary);
    margin-top: 0.16rem;
}

.portfolio-page .optimizer-card.good { border-left-color: rgba(16,185,129,0.7); }
.portfolio-page .optimizer-card.warn { border-left-color: rgba(245,158,11,0.66); }
.portfolio-page .optimizer-card.risk { border-left-color: rgba(239,68,68,0.66); }
.portfolio-page .optimizer-card.good .value { color: #10b981; }
.portfolio-page .optimizer-card.warn .value { color: #f59e0b; }
.portfolio-page .optimizer-card.risk .value { color: #ef4444; }

.portfolio-page .optimizer-suggestions {
    margin-top: 0.56rem;
    border: 1px solid rgba(92,116,147,0.3);
    border-radius: 8px;
    background: rgba(255,255,255,0.005);
    padding: 0.52rem 0.58rem;
}

.portfolio-page .optimizer-suggestions h4 {
    margin: 0 0 0.34rem;
    font-size: 0.67rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.portfolio-page .optimizer-suggestions ul {
    margin: 0;
    padding: 0;
    list-style: none;
}

.portfolio-page .optimizer-suggestions li {
    margin: 0;
    padding: 0.34rem 0;
    color: var(--text-secondary);
    font-size: 0.78rem;
    border-top: 1px dashed rgba(127,148,177,0.26);
}

.portfolio-page .optimizer-suggestions li:first-child {
    border-top: 0;
    padding-top: 0;
}

.portfolio-page .optimizer-suggestions li strong {
    color: var(--text-primary);
    font-weight: 700;
}

.portfolio-page .optimizer-suggestions li.tone-good {
    border-left: 2px solid rgba(16, 185, 129, 0.66);
    padding-left: 0.55rem;
}

.portfolio-page .optimizer-suggestions li.tone-warn {
    border-left: 2px solid rgba(245, 158, 11, 0.66);
    padding-left: 0.55rem;
}

.portfolio-page .optimizer-suggestions li.tone-risk {
    border-left: 2px solid rgba(239, 68, 68, 0.66);
    padding-left: 0.55rem;
}

.portfolio-page .optimizer-suggestion-tag {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    margin-right: 0.42rem;
    padding: 0.12rem 0.38rem;
    border-radius: 999px;
    border: 1px solid rgba(57, 194, 255, 0.28);
    background: rgba(57, 194, 255, 0.09);
    color: #d8ecff;
    font-size: 0.66rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.portfolio-page .tax-value-panel .value-amount {
    font-size: 1.18rem;
}

.portfolio-page .tax-value-note {
    color: var(--text-primary);
}

.portfolio-page .top-stats-primary .value-panel .value-meta-note,
.portfolio-page .top-stats-primary .eval-panel p:last-child,
.public-portfolio-page .top-stats-primary .value-panel .value-meta-note,
.public-portfolio-page .top-stats-primary .eval-panel p:last-child,
.portfolio-page .top-stats-secondary .value-panel .value-meta-note {
    line-height: 1.24;
    font-size: 0.7rem;
    color: var(--text-muted);
}

.portfolio-page .top-stats-primary .tax-value-panel .value-meta-note,
.portfolio-page .top-stats-secondary .tax-value-panel .value-meta-note {
    margin-top: 0.18rem;
}

.portfolio-page .top-stats-secondary .detail-chip-row {
    margin-top: 0.28rem;
    gap: 0.22rem;
}

.portfolio-page .top-stats-secondary .detail-chip {
    padding: 0.12rem 0.34rem;
    font-size: 0.62rem;
    border-radius: 999px;
}

.portfolio-page .top-stats-secondary .detail-chip-link {
    text-decoration: none;
}

.portfolio-tax-page .portfolio-toolbar {
    margin-bottom: 1rem;
}

.portfolio-tax-page .evaluator-detail-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.9rem;
}

.portfolio-tax-page .accounting-summary-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.8rem;
    margin-top: 1rem;
}

.portfolio-tax-page .summary-card,
.portfolio-tax-page .detail-card {
    min-height: 0;
}

.portfolio-tax-page .summary-card {
    padding: 0.86rem 0.94rem;
}

.portfolio-tax-page .summary-card .value {
    font-size: 1.12rem;
}

.portfolio-tax-page .summary-card .meta {
    line-height: 1.32;
}

.portfolio-tax-page .summary-card .meta:empty {
    display: none;
}

.portfolio-tax-page .detail-card {
    padding: 1rem 1.05rem;
}

.portfolio-tax-page .accounting-entry-form {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    padding: 0;
}

.portfolio-tax-page .accounting-entry-note,
.portfolio-tax-page .field-action {
    grid-column: 1 / -1;
}

.portfolio-tax-page .field-action {
    display: flex;
    justify-content: flex-start;
}

.portfolio-tax-page .field-action .btn-primary {
    min-height: 46px;
}

.portfolio-tax-page .detail-list {
    margin-top: 0.5rem;
}

.portfolio-tax-page .detail-chip-row {
    margin-top: 0.2rem;
}

.portfolio-tax-page .detail-card .subtitle {
    margin-top: 0.42rem;
    font-size: 0.76rem;
    line-height: 1.4;
    color: var(--text-secondary);
}

.portfolio-tax-page .detail-card .detail-chip-row + .subtitle {
    margin-top: 0.5rem;
}

.portfolio-tax-page .evaluator-history-section,
.portfolio-tax-page .evaluator-holdings-section {
    margin-top: 1rem;
}

.portfolio-tax-page .table-container {
    margin-top: 0.75rem;
}

.portfolio-tax-page .audit-holdings-stack {
    margin-top: 0.75rem;
}

.portfolio-evaluator-page .evaluator-detail-grid,
.portfolio-evaluator-run-page .evaluator-detail-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.82rem;
}

.portfolio-evaluator-page .detail-card,
.portfolio-evaluator-run-page .detail-card,
.portfolio-evaluator-page .audit-holding-card,
.portfolio-evaluator-run-page .audit-holding-card {
    min-width: 0;
    overflow: hidden;
}

.portfolio-evaluator-page .detail-card,
.portfolio-evaluator-run-page .detail-card {
    padding: 0.92rem 0.98rem;
}

.portfolio-evaluator-page .detail-list-compact,
.portfolio-evaluator-run-page .detail-list-compact {
    margin-top: 0.32rem;
}

.portfolio-evaluator-page .detail-list-compact li,
.portfolio-evaluator-run-page .detail-list-compact li {
    font-size: 0.78rem;
    line-height: 1.42;
}

.portfolio-evaluator-page .evaluator-steps-section,
.portfolio-evaluator-page .evaluator-holdings-section,
.portfolio-evaluator-page .evaluator-history-section,
.portfolio-evaluator-page .evaluator-delta-section,
.portfolio-evaluator-page .evaluator-tax-section,
.portfolio-evaluator-run-page .evaluator-holdings-section,
.portfolio-evaluator-run-page .evaluator-history-section,
.portfolio-evaluator-run-page .evaluator-delta-section,
.portfolio-evaluator-run-page .evaluator-tax-section {
    margin-top: 0.9rem;
}

.portfolio-evaluator-page .split-header,
.portfolio-evaluator-run-page .split-header {
    margin-bottom: 0.72rem;
}

.portfolio-evaluator-page .audit-holdings-stack,
.portfolio-evaluator-run-page .audit-holdings-stack {
    gap: 0.82rem;
}

.portfolio-evaluator-page .audit-holding-card,
.portfolio-evaluator-run-page .audit-holding-card {
    padding: 0.92rem 0.98rem;
}

.portfolio-evaluator-page .audit-holding-header,
.portfolio-evaluator-run-page .audit-holding-header {
    align-items: flex-start;
    gap: 0.82rem;
}

.portfolio-evaluator-page .audit-holding-header > div,
.portfolio-evaluator-run-page .audit-holding-header > div {
    min-width: 0;
}

.portfolio-evaluator-page .audit-holding-meta,
.portfolio-evaluator-run-page .audit-holding-meta {
    justify-content: flex-end;
}

.portfolio-evaluator-page .audit-step-list,
.portfolio-evaluator-run-page .audit-step-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.72rem;
}

.portfolio-evaluator-page .audit-step-row,
.portfolio-evaluator-run-page .audit-step-row {
    min-width: 0;
}

.portfolio-evaluator-page .audit-step-row-wide,
.portfolio-evaluator-run-page .audit-step-row-wide {
    grid-column: 1 / -1;
}

.portfolio-evaluator-page .audit-step-row-value,
.portfolio-evaluator-page .audit-step-row-detail,
.portfolio-evaluator-run-page .audit-step-row-value,
.portfolio-evaluator-run-page .audit-step-row-detail {
    overflow-wrap: anywhere;
    word-break: break-word;
}

.portfolio-evaluator-page .audit-step-row-detail,
.portfolio-evaluator-run-page .audit-step-row-detail {
    line-height: 1.45;
}

.portfolio-evaluator-page .audit-step-inline-meta,
.portfolio-evaluator-run-page .audit-step-inline-meta {
    margin-top: 0.42rem;
}

.detail-chip.detail-chip-quiet {
    background: rgba(255, 255, 255, 0.04);
    border-color: rgba(110, 133, 166, 0.28);
    color: var(--text-secondary);
}

.portfolio-evaluator-page .table-container,
.portfolio-evaluator-run-page .table-container {
    overflow-x: auto;
}

.portfolio-evaluator-page .market-table,
.portfolio-evaluator-run-page .market-table {
    width: 100%;
    min-width: 860px;
}

.portfolio-page .charts-grid {
    display: grid;
    grid-template-columns: 1fr 1.55fr;
    gap: 0.7rem;
    margin-bottom: 0.9rem;
}

.portfolio-page .chart-container {
    background: linear-gradient(180deg, rgba(14, 26, 42, 0.96), rgba(10, 19, 31, 0.98));
    border: 1px solid rgba(51, 89, 127, 0.38);
}

.portfolio-page .chart-title {
    font-size: 0.62rem;
    color: var(--text-muted);
    margin: 0 0 0.62rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.portfolio-page .chart-canvas-wrap {
    height: 200px;
}

.portfolio-page .add-stock-grid {
    display: grid;
    grid-template-columns: 84px minmax(220px, 2fr) minmax(148px, 1.15fr) 118px 112px 112px 92px auto;
    gap: 0.48rem;
    background: rgba(12, 23, 38, 0.94);
    padding: 0.62rem;
    border-radius: 12px;
    border: 1px solid rgba(51, 89, 127, 0.28);
    margin: 0 0 0.62rem;
    align-items: end;
}

.portfolio-page .add-stock-grid .form-group label {
    display: block;
    font-size: 0.58rem;
    color: var(--text-muted);
    margin-bottom: 0.18rem;
    text-transform: uppercase;
    font-weight: 700;
}

.portfolio-page .add-stock-grid .ticker-field {
    position: relative;
}

.portfolio-page .add-stock-grid input,
.portfolio-page .add-stock-grid select {
    width: 100%;
    background: var(--bg-root);
    border: 1px solid rgba(74, 95, 129, 0.58);
    color: white;
    padding: 0.46rem 0.56rem;
    border-radius: 8px;
    font-size: 0.8rem;
}

.portfolio-page .add-stock-grid .ticker-suggestions {
    top: 100%;
    left: 0;
    right: 0;
}

.portfolio-page .add-stock-grid .trade-tax-account-group {
    min-width: 0;
}

.portfolio-page .add-stock-grid .trade-assignment-status {
    margin-top: 0.32rem;
    padding: 0.34rem 0.46rem;
    border-radius: 9px;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 0.42rem;
    align-items: center;
}

.portfolio-page .add-stock-grid .trade-assignment-status .assignment-status-copy strong {
    font-size: 0.69rem;
}

.portfolio-page .add-stock-grid .trade-assignment-status .assignment-status-copy span {
    font-size: 0.64rem;
    line-height: 1.3;
}

.portfolio-page .add-stock-grid .trade-assignment-status a {
    font-size: 0.66rem;
    white-space: nowrap;
}

.portfolio-page .add-stock-grid .trade-submit-group {
    align-self: end;
}

.portfolio-page .add-stock-grid .trade-submit-group .btn-primary {
    width: 100%;
    min-height: 38px;
    padding: 0.46rem 0.72rem;
    font-size: 0.78rem;
}

.portfolio-page .holding-row {
    cursor: pointer;
    transition: background 0.2s;
}

.portfolio-page .holding-row:hover {
    background: var(--bg-card-hover) !important;
}

.portfolio-page .tx-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
}

.portfolio-page .tx-log-toolbar {
    display: grid;
    grid-template-columns: minmax(180px, 240px) minmax(0, 1fr);
    gap: 0.7rem;
    align-items: center;
    margin-bottom: 0.72rem;
    padding-bottom: 0.72rem;
    border-bottom: 1px solid rgba(74, 95, 129, 0.2);
}

.portfolio-page .tx-log-filter {
    display: flex;
    flex-direction: column;
    gap: 0.22rem;
    min-width: 0;
}

.portfolio-page .tx-log-filter label {
    font-size: 0.62rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 700;
}

.portfolio-page .tx-log-filter select {
    min-height: 38px;
    font-size: 0.82rem;
}

.portfolio-page .tx-log-summary {
    display: flex;
    gap: 0.4rem;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
}

.portfolio-page .tx-log-count,
.portfolio-page .tx-log-unassigned {
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    padding: 0.28rem 0.56rem;
    font-size: 0.72rem;
    font-weight: 700;
    border: 1px solid var(--border-subtle);
    background: rgba(255, 255, 255, 0.03);
    color: var(--text-secondary);
}

.portfolio-page .tx-log-unassigned {
    border-color: rgba(245, 158, 11, 0.34);
    color: #fbbf24;
    background: rgba(245, 158, 11, 0.08);
}

.portfolio-page .tx-log-status {
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    padding: 0.28rem 0.56rem;
    font-size: 0.72rem;
    font-weight: 700;
    border: 1px solid var(--border-subtle);
    background: rgba(255, 255, 255, 0.03);
    color: var(--text-secondary);
}

.portfolio-page .tx-log-status.good {
    border-color: rgba(16, 185, 129, 0.3);
    background: rgba(16, 185, 129, 0.08);
    color: #6ee7b7;
}

.portfolio-page .tx-log-status.warn {
    border-color: rgba(245, 158, 11, 0.34);
    background: rgba(245, 158, 11, 0.08);
    color: #fbbf24;
}

.portfolio-page .tx-bulk-assign-form {
    margin-top: 0.7rem;
    padding: 0.72rem 0.8rem;
    border-radius: 10px;
    border: 1px solid rgba(245, 158, 11, 0.16);
    background: rgba(245, 158, 11, 0.05);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.7rem;
    flex-wrap: wrap;
}

.portfolio-page .tx-bulk-assign-copy {
    display: flex;
    flex-direction: column;
    gap: 0.22rem;
    flex: 1 1 260px;
    min-width: 240px;
}

.portfolio-page .tx-bulk-assign-copy strong {
    color: var(--text-primary);
    font-size: 0.84rem;
}

.portfolio-page .tx-bulk-assign-copy span {
    color: var(--text-secondary);
    font-size: 0.76rem;
}

.portfolio-page .tx-bulk-assign-controls {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    flex-wrap: wrap;
}

.portfolio-page .tx-bulk-assign-controls select {
    width: auto;
    min-width: 160px;
}

.portfolio-page .tx-table-shell {
    overflow-x: auto;
}

.portfolio-page .tx-table th {
    font-size: 0.62rem;
    color: var(--text-muted);
    text-align: left;
    padding: 0.42rem 0.45rem;
}

.portfolio-page .tx-table td {
    padding: 0.58rem 0.45rem;
    border-top: 1px solid var(--border-subtle);
    font-size: 0.82rem;
}

.portfolio-page .tx-empty-state {
    text-align: center;
    color: var(--text-muted);
    padding: 1rem 0.5rem;
}

.portfolio-page .tx-action-btn {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(74, 95, 129, 0.22);
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0.28rem 0.55rem;
    font-size: 0.74rem;
    border-radius: 999px;
}

.portfolio-page .tx-inline-form {
    display: inline;
}

.portfolio-page .tx-remove-btn {
    background: transparent;
    border: none;
    color: #ef4444;
    cursor: pointer;
    margin-left: 8px;
    padding: 0;
    font-size: 0.92rem;
    line-height: 1;
}

.portfolio-page .modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(3, 10, 18, 0.78);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    backdrop-filter: none;
}

.portfolio-page .modal-content {
    background: #0c1728;
    padding: 1.05rem;
    border-radius: 12px;
    width: 560px;
    border: 1px solid rgba(51, 89, 127, 0.26);
    max-height: min(90vh, calc(100vh - 2rem));
    overflow-y: auto;
    box-shadow: 0 14px 26px rgba(0, 0, 0, 0.18);
}

.portfolio-page .modal-content.modal-sm { width: min(92vw, 420px); }
.portfolio-page .modal-content.modal-md { width: min(92vw, 560px); }
.portfolio-page .modal-content.modal-lg { width: min(95vw, 760px); }
.portfolio-page .modal-content.modal-front { z-index: 1100; }

.portfolio-page .modal-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.58rem;
    gap: 0.55rem;
}

.portfolio-page .modal-head.modal-head-wide {
    margin-bottom: 0.78rem;
}

.portfolio-page .modal-head h2 {
    margin: 0;
    font-size: 0.95rem;
    line-height: 1.2;
}

.portfolio-page .modal-close-btn {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(74, 95, 129, 0.2);
    color: #fff;
    font-size: 1rem;
    cursor: pointer;
    line-height: 1;
    padding: 0.3rem;
    min-width: 32px;
    min-height: 32px;
    border-radius: 999px;
}

.portfolio-page .modal-form select,
.portfolio-page .modal-form input {
    width: 100%;
    background: var(--bg-root);
    border: 1px solid var(--border-active);
    color: #fff;
    padding: 0.56rem 0.66rem;
    border-radius: 8px;
    box-sizing: border-box;
    min-height: 40px;
    font-size: 0.84rem;
}

.portfolio-page .modal-form .form-group {
    margin-bottom: 0.52rem;
}

.portfolio-page .modal-form .form-group label {
    display: block;
    margin-bottom: 0.18rem;
    font-size: 0.64rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 700;
}

.portfolio-page .modal-actions {
    display: flex;
    gap: 0.45rem;
    margin-top: 0.72rem;
}

.portfolio-page .modal-actions .btn-secondary,
.portfolio-page .modal-actions .btn-primary {
    flex: 1;
}

.portfolio-page .modal-form-grid-fields {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.52rem 0.62rem;
}

.portfolio-page .modal-form-grid-fields .form-group {
    margin-bottom: 0;
}

.portfolio-page .modal-form .form-group.form-group-full {
    margin-top: 0.18rem;
}

.portfolio-page .tx-log-modal-shell {
    width: min(94vw, 720px);
}

.portfolio-page .edit-tx-modal-shell {
    width: min(92vw, 500px);
}

.portfolio-page .sell-tx-modal-shell {
    width: min(92vw, 500px);
}

.portfolio-page .modal-inline-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem;
    margin-bottom: 0.72rem;
}

.portfolio-page .modal-inline-meta .detail-chip strong {
    color: var(--text-primary);
    font-weight: 700;
}

.portfolio-page .portfolio-create-modal {
    width: min(94vw, 680px);
    padding: 1rem;
    border-radius: 18px;
    border: 1px solid rgba(84, 109, 145, 0.22);
    background: linear-gradient(180deg, rgba(13, 24, 41, 0.98) 0%, rgba(8, 15, 28, 0.98) 100%);
    box-shadow: 0 28px 60px rgba(0, 0, 0, 0.42);
}

.portfolio-page .modal-kicker {
    display: none;
}

.portfolio-page .modal-subtitle {
    display: none;
}

.portfolio-page .portfolio-create-modal .modal-head {
    align-items: center;
    padding-bottom: 0.7rem;
    margin-bottom: 0.75rem;
}

.portfolio-page .portfolio-create-modal .modal-head h2 {
    margin: 0;
    font-size: 1.18rem;
    line-height: 1.2;
}

.portfolio-page .portfolio-create-wizard {
    display: grid;
    gap: 0.78rem;
}

.portfolio-page .portfolio-wizard-progress-index {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.55rem;
    height: 1.55rem;
    border-radius: 999px;
    border: 1px solid rgba(120, 146, 181, 0.24);
    background: rgba(11, 22, 39, 0.84);
    color: var(--text-muted);
    font-size: 0.74rem;
    font-weight: 700;
    flex: 0 0 auto;
}

.portfolio-page .portfolio-wizard-progress-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.38rem;
    justify-content: center;
}

.portfolio-page .portfolio-wizard-progress-step {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    min-width: 0;
    padding: 0.34rem 0.5rem;
    border-radius: 999px;
    color: var(--text-secondary);
    transition: background 0.18s ease, border-color 0.18s ease, color 0.18s ease;
    border: 1px solid rgba(84, 109, 145, 0.18);
    background: rgba(255, 255, 255, 0.025);
}

.portfolio-page .portfolio-wizard-progress-step.is-active {
    border-color: rgba(56, 189, 248, 0.26);
    background: rgba(56, 189, 248, 0.1);
    color: #f8fafc;
}

.portfolio-page .portfolio-wizard-progress-step.is-complete {
    color: #dbeafe;
}

.portfolio-page .portfolio-wizard-progress-step.is-active .portfolio-wizard-progress-index,
.portfolio-page .portfolio-wizard-progress-step.is-complete .portfolio-wizard-progress-index {
    color: #e0f2fe;
    border-color: rgba(56, 189, 248, 0.3);
    background: linear-gradient(180deg, rgba(15, 43, 68, 0.96) 0%, rgba(10, 30, 49, 0.98) 100%);
}

.portfolio-page .portfolio-wizard-progress-label {
    display: none;
}

.portfolio-page .portfolio-wizard-main {
    min-width: 0;
    padding: 0.95rem;
    border-radius: 16px;
    border: 1px solid rgba(84, 109, 145, 0.22);
    background: rgba(255, 255, 255, 0.03);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03);
}

.portfolio-page .portfolio-wizard-step-meta {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.28rem 0.52rem;
    border-radius: 999px;
    border: 1px solid rgba(84, 109, 145, 0.22);
    background: rgba(255, 255, 255, 0.035);
    font-size: 0.76rem;
    color: var(--text-muted);
    margin-bottom: 0.72rem;
}

.portfolio-page .portfolio-wizard-panel {
    display: grid;
    gap: 0.7rem;
    min-height: 160px;
    align-content: start;
}

.portfolio-page .portfolio-wizard-section-head h3 {
    margin: 0;
    font-size: 1.02rem;
    color: #f8fafc;
    letter-spacing: -0.01em;
}

.portfolio-page .portfolio-wizard-section-head p {
    display: none;
}

.portfolio-page .portfolio-wizard-option-grid {
    display: grid;
    gap: 0.62rem;
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.portfolio-page .portfolio-wizard-option-grid-three {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.portfolio-page .portfolio-wizard-choice {
    position: relative;
}

.portfolio-page .portfolio-wizard-choice input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.portfolio-page .portfolio-wizard-option {
    display: grid;
    place-items: center;
    text-align: center;
    min-height: 82px;
    padding: 0.8rem 0.75rem;
    border-radius: 12px;
    border: 1px solid rgba(77, 104, 140, 0.28);
    background: rgba(11, 22, 39, 0.72);
    cursor: pointer;
    transition: border-color 0.18s ease, transform 0.18s ease, background 0.18s ease, box-shadow 0.18s ease;
}

.portfolio-page .portfolio-wizard-option:hover {
    border-color: rgba(96, 165, 250, 0.38);
}

.portfolio-page .portfolio-wizard-option strong {
    color: #f8fafc;
    font-size: 0.9rem;
    letter-spacing: 0;
}

.portfolio-page .portfolio-wizard-choice input:checked + .portfolio-wizard-option {
    border-color: rgba(56, 189, 248, 0.72);
    box-shadow: inset 0 0 0 1px rgba(56, 189, 248, 0.22);
    background: rgba(17, 40, 66, 0.94);
}

.portfolio-page .portfolio-wizard-actions {
    margin-top: 0.15rem;
}

.portfolio-page .portfolio-wizard-name-field {
    max-width: none;
}

.portfolio-page .portfolio-wizard-name-field input {
    min-height: 64px;
    padding: 0 1rem;
    font-size: 1.08rem;
    font-weight: 600;
    border-radius: 14px;
    border: 1px solid rgba(148, 163, 184, 0.2);
    background: #f8fafc;
    color: #0f172a;
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.14);
}

.portfolio-page .portfolio-wizard-name-field input::placeholder {
    color: #64748b;
}

.portfolio-page #create-portfolio-form button[type="submit"][hidden],
.portfolio-page #create-portfolio-form button[type="button"][hidden] {
    display: none !important;
}

.portfolio-page .export-section {
    background: rgba(9, 18, 31, 0.18);
    padding: 0.56rem 0.64rem;
    border-radius: 9px;
    border: 1px solid rgba(74, 95, 129, 0.14);
    margin-top: 0.66rem;
}

.portfolio-page .export-title {
    font-size: 0.62rem;
    color: rgba(148, 163, 184, 0.78);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin: 0;
}

.portfolio-page .export-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.portfolio-page .export-format-group {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.2rem;
    border-radius: 999px;
    background: rgba(12, 24, 39, 0.84);
    border: 1px solid rgba(51, 89, 127, 0.3);
}

.portfolio-page .export-format-option {
    position: relative;
    cursor: pointer;
}

.portfolio-page .export-format-option input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.portfolio-page .export-format-option span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 58px;
    min-height: 34px;
    padding: 0.3rem 0.72rem;
    border-radius: 999px;
    color: rgba(226, 232, 240, 0.88);
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    transition: background 0.15s ease, color 0.15s ease;
}

.portfolio-page .export-format-option input:checked + span {
    background: linear-gradient(180deg, #edf4fc 0%, #d7e6f6 100%);
    color: #081321;
}

.portfolio-page .export-grid {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 0.38rem;
    align-items: center;
    margin-top: 0.48rem;
}

.portfolio-page .export-custom-range {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto;
    gap: 0.44rem;
    align-items: end;
    margin-top: 0.56rem;
    border-top: 1px solid rgba(74, 95, 129, 0.26);
    padding-top: 0.62rem;
}

.portfolio-page .export-field {
    display: flex;
    flex-direction: column;
    gap: 0.22rem;
}

.portfolio-page .export-field-label {
    font-size: 0.62rem;
    color: rgba(148, 163, 184, 0.76);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.portfolio-page .export-input {
    background: var(--bg-root);
    border: 1px solid var(--border-active);
    color: #fff;
    padding: 0.32rem 0.42rem;
    border-radius: 7px;
    font-size: 0.7rem;
}

.portfolio-page .export-custom-btn {
    padding: 0.36rem 0.68rem;
    font-size: 0.7rem;
}

.portfolio-page .import-section {
    background: rgba(9, 18, 31, 0.18);
    padding: 0.56rem 0.64rem;
    border-radius: 9px;
    border: 1px solid rgba(74, 95, 129, 0.14);
    margin: 0.56rem 0 0.72rem;
}

.portfolio-page .import-summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    cursor: pointer;
    list-style: none;
    font-size: 0.68rem;
    color: var(--text-primary);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.portfolio-page .import-summary::-webkit-details-marker { display: none; }
.portfolio-page .import-summary::after { content: "+"; color: var(--text-secondary); font-size: 1rem; line-height: 1; }
.portfolio-page .import-collapsible[open] .import-summary::after { content: "-"; }

.portfolio-page .import-body {
    margin-top: 0.34rem;
}

.portfolio-page .import-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.4fr) minmax(132px, 0.8fr) auto auto;
    gap: 0.38rem;
    align-items: center;
}

.portfolio-page .import-grid input[type="file"] {
    width: 100%;
    background: var(--bg-root);
    border: 1px solid var(--border-active);
    color: white;
    padding: 0.38rem 0.48rem;
    border-radius: 8px;
    font-size: 0.74rem;
}

.portfolio-page .import-grid .import-tax-account {
    min-height: 36px;
    font-size: 0.74rem;
}

.portfolio-page .import-grid .import-assignment-status {
    grid-column: 1 / -1;
    margin: 0;
    padding: 0.34rem 0.46rem;
    border-radius: 9px;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 0.42rem;
    align-items: center;
}

.portfolio-page .import-grid .import-assignment-status .assignment-status-copy strong {
    font-size: 0.69rem;
}

.portfolio-page .import-grid .import-assignment-status .assignment-status-copy span {
    font-size: 0.64rem;
    line-height: 1.3;
}

.portfolio-page .import-grid .import-assignment-status a {
    font-size: 0.66rem;
    white-space: nowrap;
}

.portfolio-page .import-replace {
    color: var(--text-secondary);
    font-size: 0.68rem;
    display: inline-flex;
    align-items: center;
    gap: 0.32rem;
    white-space: nowrap;
}

.portfolio-page .portfolio-settings .field-help,
.portfolio-page .move-modal-current {
    display: none;
}

.portfolio-page .portfolio-alert {
    border-radius: 10px;
    padding: 0.72rem 0.85rem;
    margin: 0 0 1rem;
    font-size: 0.9rem;
    border: 1px solid;
}

.portfolio-page .portfolio-alert.is-success {
    background: rgba(16,185,129,0.14);
    border-color: rgba(16,185,129,0.38);
    color: #d1fae5;
}

.portfolio-page .portfolio-alert.is-error {
    background: rgba(239,68,68,0.14);
    border-color: rgba(239,68,68,0.38);
    color: #fecaca;
}

.portfolio-page .portfolio-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 0.64rem;
    margin: 0 0 0.62rem;
    padding-bottom: 0.28rem;
    border-bottom: 1px solid rgba(92, 116, 147, 0.24);
}

.portfolio-page .portfolio-context {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    min-width: 0;
}

.portfolio-page .portfolio-title {
    margin: 0;
    color: var(--text-primary);
    font-size: 0.98rem;
    font-weight: 800;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.portfolio-page .portfolio-meta {
    display: flex;
    align-items: center;
    gap: 0.36rem;
    flex-wrap: wrap;
}

.portfolio-page .portfolio-chip {
    display: inline-flex;
    align-items: center;
    border: 1px solid var(--border-subtle);
    border-radius: 999px;
    padding: 0.14rem 0.44rem;
    font-size: 0.66rem;
    color: var(--text-secondary);
    background: rgba(255,255,255,0.03);
}

.portfolio-page .toolbar-actions {
    display: inline-flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.45rem;
    flex-wrap: wrap;
}

.portfolio-page .currency-form {
    display: inline-flex;
    align-items: center;
    margin: 0;
}

.portfolio-page .currency-form select {
    min-height: 32px;
    padding: 0.22rem 1.9rem 0.22rem 0.58rem;
    font-size: 0.72rem;
    border-radius: 999px;
    background-position: right 0.62rem center;
}

.portfolio-page .settings-open-btn {
    min-height: 32px;
    padding: 0.24rem 0.62rem;
    font-size: 0.72rem;
}

.portfolio-page .portfolio-chip-link {
    text-decoration: none;
    color: var(--text-primary);
}

.portfolio-page .portfolio-chip.tone-good {
    border-color: rgba(16, 185, 129, 0.3);
    background: rgba(16, 185, 129, 0.1);
    color: #6ee7b7;
}

.portfolio-page .portfolio-chip.tone-warn,
.portfolio-page .portfolio-chip-link.tone-warn {
    border-color: rgba(245, 158, 11, 0.34);
    background: rgba(245, 158, 11, 0.1);
    color: #fbbf24;
}

.portfolio-page .portfolio-chip.tone-good:hover,
.portfolio-page .portfolio-chip.tone-warn:hover,
.portfolio-page .portfolio-chip-link.tone-warn:hover {
    filter: brightness(1.06);
}

.portfolio-page .toolbar-actions {
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
}

.portfolio-page .settings-open-btn {
    padding: 0.42rem 0.68rem;
    font-size: 0.76rem;
    white-space: nowrap;
    min-height: 38px;
}

.portfolio-page .currency-form {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    border: 1px solid rgba(74, 95, 129, 0.44);
    border-radius: 9px;
    padding: 0.4rem 0.5rem;
    background: rgba(255,255,255,0.02);
}

.portfolio-page .currency-form label {
    font-size: 0.72rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 700;
}

.portfolio-page .currency-form select {
    min-width: 110px;
    background: var(--bg-root);
    border: 1px solid rgba(74, 95, 129, 0.58);
    color: #fff;
    border-radius: 6px;
    padding: 0.28rem 0.42rem;
    font-size: 0.8rem;
}

.portfolio-page .portfolio-settings {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.75rem;
}

.portfolio-page .portfolio-settings-modal-shell {
    width: min(92vw, 520px);
}

.portfolio-page .portfolio-settings.portfolio-settings-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.7rem 0.8rem;
}

.portfolio-page .portfolio-settings .field {
    min-width: 0;
}

.portfolio-page .portfolio-settings .field.field-full {
    grid-column: 1 / -1;
}

.portfolio-page .portfolio-settings .field label {
    display: block;
    font-size: 0.68rem;
    color: var(--text-muted);
    margin-bottom: 0.25rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 700;
}

.portfolio-page .portfolio-settings input,
.portfolio-page .portfolio-settings select {
    width: 100%;
    background: var(--bg-root);
    border: 1px solid var(--border-active);
    color: #fff;
    padding: 0.5rem 0.58rem;
    border-radius: 7px;
    font-size: 0.87rem;
    min-height: 40px;
}

.portfolio-page .portfolio-settings .field-action {
    display: flex;
    align-items: end;
    justify-content: flex-end;
    gap: 0.6rem;
    flex-wrap: wrap;
    grid-column: 1 / -1;
}

.portfolio-page .portfolio-settings .field-action .btn-primary {
    min-height: 40px;
    padding: 0.5rem 0.9rem;
    white-space: nowrap;
}

.portfolio-page .portfolio-empty-state {
    text-align: center;
    padding: 5rem 0;
}

.portfolio-page .portfolio-empty-cta {
    margin-top: 2rem;
}

.portfolio-page .p-risk-meta {
    font-size: 0.6rem;
    color: var(--text-muted);
    display: none; /* replaced by p-nav-meta / p-risk-badge */
}

.portfolio-page .value-currency-inline {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.portfolio-page .value-meta-note {
    color: var(--text-secondary);
    font-size: 0.75rem;
}

.portfolio-page .portfolio-income-section {
    margin: 0 0 0.82rem;
}

.portfolio-page .dividend-summary-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.58rem;
}

.portfolio-page .dividend-summary-card .label {
    display: block;
    font-size: 0.66rem;
    letter-spacing: 0.09em;
    text-transform: uppercase;
    color: var(--text-secondary);
    margin-bottom: 0.26rem;
}

.portfolio-page .dividend-summary-card .value {
    display: block;
    font-size: 1.34rem;
    font-weight: 800;
    color: var(--text-primary);
    line-height: 1.18;
}

.portfolio-page .dividend-summary-card .meta {
    display: block;
    margin-top: 0.18rem;
    font-size: 0.75rem;
    color: var(--text-muted);
    line-height: 1.38;
}

.portfolio-page .dividend-summary-card .meta:empty {
    display: none;
}

.portfolio-page .dividend-event-title {
    margin: 0;
    padding: 0.72rem 0.84rem 0.4rem;
    font-size: 0.69rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.portfolio-page .dividend-event-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.8rem;
    padding: 0.72rem 0.84rem;
    border-top: 1px solid rgba(92, 116, 147, 0.22);
}

.portfolio-page .dividend-event-copy {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.18rem;
}

.portfolio-page .dividend-event-copy strong {
    font-size: 0.86rem;
    color: var(--text-primary);
}

.portfolio-page .dividend-event-copy span {
    font-size: 0.76rem;
    color: var(--text-secondary);
    line-height: 1.4;
}

.portfolio-page .dividend-event-amount {
    flex: 0 0 auto;
    text-align: right;
}

.portfolio-page .dividend-event-amount strong {
    display: block;
    font-size: 0.86rem;
    color: var(--text-primary);
}

.portfolio-page .dividend-event-amount span {
    display: block;
    margin-top: 0.16rem;
    font-size: 0.72rem;
    color: var(--text-muted);
}

.portfolio-page .dividend-event-amount span:empty {
    display: none;
}

.portfolio-page .dividend-history-summary {
    list-style: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.6rem;
    padding: 0.78rem 0.84rem;
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--text-primary);
}

.portfolio-page .dividend-history-summary::-webkit-details-marker { display: none; }
.portfolio-page .dividend-history-summary::after { content: "+"; color: var(--text-secondary); font-size: 1rem; line-height: 1; }
.portfolio-page .dividend-history-dropdown[open] .dividend-history-summary::after { content: "-"; }
.portfolio-page .dividend-history-panel { border-top: 1px solid rgba(92, 116, 147, 0.22); }

.portfolio-page .ticker-line {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}

.portfolio-page .holding-native-currency {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-left: 0.35rem;
    padding: 0.08rem 0.34rem;
    border-radius: 999px;
    border: 1px solid var(--border-subtle);
    background: rgba(255,255,255,0.04);
    color: var(--text-secondary);
    font-size: 0.62rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    line-height: 1.2;
}

.portfolio-page .holding-account-chip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.08rem 0.4rem;
    border-radius: 999px;
    border: 1px solid rgba(138, 155, 168, 0.28);
    background: rgba(138, 155, 168, 0.1);
    color: var(--text-secondary);
    font-size: 0.62rem;
    font-weight: 700;
    line-height: 1.2;
    white-space: nowrap;
}

.portfolio-page .holding-account-chip.tone-warn {
    border-color: rgba(245, 158, 11, 0.34);
    background: rgba(245, 158, 11, 0.1);
    color: #fbbf24;
}

.portfolio-page .holding-account-chip.tone-good {
    border-color: rgba(16, 185, 129, 0.32);
    background: rgba(16, 185, 129, 0.1);
    color: #6ee7b7;
}

.portfolio-page .holding-subline {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.28rem;
    margin-top: 0.22rem;
    font-size: 0.7rem;
    color: var(--text-muted);
    line-height: 1.3;
}

.portfolio-page .holding-id-row {
    display: flex;
    align-items: center;
    gap: 0.28rem;
    flex-wrap: wrap;
}

.portfolio-page .holding-id-row .holding-native-currency {
    margin-left: 0;
}

.portfolio-page .holding-company-name {
    color: var(--text-secondary);
    font-size: 0.72rem;
}

.portfolio-page .holding-sector-tag {
    font-size: 0.62rem;
    font-weight: 600;
    color: var(--text-muted);
    opacity: 0.75;
    letter-spacing: 0.02em;
    white-space: nowrap;
}

.portfolio-page .holding-sector-tag::before {
    content: '·';
    margin-right: 0.22rem;
    opacity: 0.5;
}

.portfolio-page .holding-tax-row {
    display: flex;
    align-items: center;
    gap: 0.32rem;
    flex-wrap: wrap;
}

.holding-day-divider {
    color: var(--text-muted);
    opacity: 0.4;
    font-size: 0.72rem;
    line-height: 1;
    margin: 0 0.05rem;
}

.portfolio-page .holding-metric {
    font-variant-numeric: tabular-nums;
}

.portfolio-page .metric-value,
.portfolio-page .metric-pl {
    font-weight: 800;
}

.portfolio-page .flag-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.2rem;
    height: 1.2rem;
    border-radius: 999px;
    background: rgba(255,255,255,0.05);
    border: 1px solid var(--border-subtle);
    overflow: hidden;
}

.portfolio-page .flag-icon {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.portfolio-page .flag-fallback {
    display: none;
    font-size: 0.52rem;
    line-height: 1;
    color: var(--text-muted);
    font-weight: 700;
}

.portfolio-page .action-stack {
    display: inline-flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.45rem;
    flex-wrap: wrap;
}

.portfolio-page .action-btn {
    min-height: 30px;
}

.portfolio-page .sell-btn { border-color: rgba(239,68,68,0.35); }
.portfolio-page .move-open-btn { border-color: rgba(56,189,248,0.42); }
.portfolio-page .history-btn { border-color: rgba(120, 143, 172, 0.24); }

.portfolio-page .move-modal-current {
    margin: 0 0 0.75rem;
    color: var(--text-secondary);
    font-size: 0.84rem;
}

.portfolio-page .move-modal-current strong {
    color: var(--text-primary);
}

.portfolio-page #move-holding-target { min-height: 44px; }
.portfolio-page .move-modal-submit { width: 100%; min-height: 44px; }
.portfolio-page .holdings-container { margin-bottom: 1rem; }
.portfolio-page .history-btn { white-space: nowrap; }
.portfolio-page .action-stack {
    display: inline-flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.26rem;
    flex-wrap: wrap;
}

.public-portfolio-page .eval-score {
    font-size: 3.5rem;
    font-weight: 900;
    color: var(--accent-buy);
    line-height: 1;
    margin: 0.15rem 0;
}

.public-portfolio-page .portfolio-income-section {
    margin: 0 0 2rem;
}

.public-portfolio-page .dividend-summary-card .label {
    display: block;
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-secondary);
    font-weight: 700;
}

.public-portfolio-page .dividend-summary-card .value {
    display: block;
    font-size: 1.32rem;
    font-weight: 800;
    color: var(--text-primary);
}

.public-portfolio-page .dividend-summary-card .meta {
    display: block;
    font-size: 0.76rem;
    color: var(--text-muted);
}

.public-portfolio-page .dividend-event-title {
    margin: 0;
    padding: 0.85rem 1rem;
    font-size: 0.95rem;
    border-bottom: 1px solid var(--border-subtle);
}

.public-portfolio-page .dividend-event-row {
    display: flex;
    justify-content: space-between;
    gap: 0.8rem;
    padding: 0.8rem 1rem;
    border-top: 1px solid rgba(255,255,255,0.05);
}

.public-portfolio-page .dividend-event-row:first-of-type {
    border-top: 0;
}

.public-portfolio-page .dividend-event-copy {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.public-portfolio-page .dividend-event-copy span {
    color: var(--text-muted);
    font-size: 0.78rem;
}

.public-portfolio-page .dividend-event-amount {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.15rem;
}

.public-portfolio-page .dividend-event-amount span {
    color: var(--text-muted);
    font-size: 0.74rem;
}

.public-portfolio-page .dividend-history-summary {
    list-style: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.6rem;
    padding: 0.85rem 1rem;
    font-size: 0.84rem;
    font-weight: 700;
    color: var(--text-primary);
}

.public-portfolio-page .dividend-history-summary::-webkit-details-marker { display: none; }
.public-portfolio-page .dividend-history-summary::after { content: "+"; color: var(--text-secondary); font-size: 1rem; line-height: 1; }
.public-portfolio-page .dividend-history-dropdown[open] .dividend-history-summary::after { content: "-"; }
.public-portfolio-page .dividend-history-panel { border-top: 1px solid var(--border-subtle); }

.public-portfolio-page .directory-header.split-header {
    align-items: flex-end;
}

.public-portfolio-page .value-amount.public-value-amount {
    font-size: clamp(1.8rem, 4vw, 2.5rem);
    font-weight: 800;
    color: var(--text-primary);
    margin: 0.35rem 0;
}

.public-portfolio-page .chart-wrap-centered {
    max-height: 250px;
    display: flex;
    justify-content: center;
}

.public-portfolio-page .holding-name.compact {
    font-size: 0.76rem;
    color: var(--text-muted);
}

@media (max-width: 900px) {
    .public-portfolio-page .directory-header.split-header {
        align-items: stretch;
    }

    .public-portfolio-page .dividend-event-row {
        flex-direction: column;
        align-items: flex-start;
    }

    .public-portfolio-page .dividend-event-amount {
        align-items: flex-start;
    }

    .public-portfolio-page .public-holdings-table td.metric-amount,
    .public-portfolio-page .public-holdings-table td.metric-avg,
    .public-portfolio-page .public-holdings-table td.metric-price {
        display: none !important;
    }
}

@media (max-width: 900px) {
    .portfolio-page {
        padding-top: 0.85rem;
        padding-bottom: 1rem;
    }

    .portfolio-page .portfolio-layout {
        grid-template-columns: 1fr;
        gap: 1rem;
        margin-top: 0.85rem;
    }

    .portfolio-page .sidebar {
        display: flex;
        align-items: stretch;
        gap: 0.55rem;
        overflow-x: auto;
        scroll-snap-type: x mandatory;
        padding: 0.05rem 0 0.5rem;
        border: 0;
        border-radius: 0;
        background: transparent;
        margin-bottom: 0.1rem;
        scrollbar-width: none;
        -webkit-overflow-scrolling: touch;
    }

    .portfolio-page .sidebar::-webkit-scrollbar { display: none; }
    .portfolio-page .sidebar-header { display: none; }

    .portfolio-page .p-nav-item {
        flex: 0 0 auto;
        min-width: 152px;
        margin: 0;
        padding: 0.6rem 0.72rem 0.6rem 0.78rem;
        border: 1px solid rgba(74, 95, 129, 0.38);
        border-left: 2px solid rgba(74, 95, 129, 0.38);
        border-radius: 9px;
        background: rgba(10, 18, 34, 0.88);
        scroll-snap-align: start;
        min-height: 58px;
        box-sizing: border-box;
    }

    .portfolio-page .p-nav-item.active {
        background: rgba(18, 36, 64, 0.95);
        border-color: rgba(57, 194, 255, 0.22);
        border-left-color: rgba(57, 194, 255, 0.65);
    }

    .portfolio-page .p-nav-name {
        font-size: 0.82rem;
    }

    .portfolio-page .create-p-btn {
        flex: 0 0 auto;
        min-width: 138px;
        margin-top: 0;
        padding: 0.6rem 0.72rem;
        border-radius: 9px;
        background: rgba(10, 18, 34, 0.72);
        scroll-snap-align: start;
        font-size: 0.76rem;
        min-height: 58px;
        box-sizing: border-box;
        flex-direction: column;
        gap: 0.24rem;
        border-style: dashed;
    }

    .portfolio-page .portfolio-toolbar {
        flex-direction: column;
        align-items: stretch;
        margin-bottom: 0.72rem;
        border: 1px solid rgba(74,95,129,0.28);
        border-radius: 12px;
        background: rgba(8,14,26,0.34);
        padding: 0.72rem;
    }

    .portfolio-page .portfolio-context { gap: 0.34rem; }
    .portfolio-page .portfolio-title { white-space: normal; line-height: 1.2; }
    .portfolio-page .portfolio-meta { gap: 0.38rem; }
    .portfolio-page .portfolio-chip { min-height: 28px; padding: 0.24rem 0.55rem; }

    .portfolio-page .toolbar-actions {
        width: 100%;
        display: grid;
        grid-template-columns: 1fr;
        gap: 0.48rem;
    }

    .portfolio-page .settings-open-btn { min-height: 44px; font-size: 0.84rem; }

    .portfolio-page .currency-form {
        width: 100%;
        justify-content: space-between;
        padding: 0.52rem 0.58rem;
    }

    .portfolio-page .currency-form label { font-size: 0.68rem; }

    .portfolio-page .currency-form select {
        flex: 1;
        min-height: 44px;
        font-size: 0.86rem;
    }

    .portfolio-page .top-stats {
        gap: 0.52rem;
        margin-bottom: 0.62rem;
        border: 0;
        border-radius: 0;
        background: transparent;
        padding: 0;
    }

    .portfolio-page .top-stats-primary,
    .portfolio-page .top-stats-secondary,
    .public-portfolio-page .top-stats-primary,
    .public-portfolio-page .top-stats-secondary {
        grid-template-columns: 1fr;
        gap: 0.52rem;
        margin-top: 0;
    }

    .portfolio-page .dividend-summary-grid { grid-template-columns: 1fr; gap: 0.5rem; }
    .portfolio-page .dividend-summary-card { padding: 0.72rem 0.76rem; border-radius: 10px; }
    .portfolio-page .dividend-summary-card .value { font-size: 1.18rem; }
    .portfolio-page .dividend-event-row { padding: 0.68rem 0.74rem; align-items: flex-start; }
    .portfolio-page .dividend-event-copy strong { font-size: 0.82rem; }

    .portfolio-page .dividend-event-copy span,
    .portfolio-page .dividend-event-amount span { font-size: 0.72rem; }

    .portfolio-page .dividend-event-amount strong { font-size: 0.82rem; }

    .portfolio-page .eval-panel,
    .portfolio-page .value-panel {
        border: 1px solid rgba(74, 95, 129, 0.3);
        border-radius: 10px;
        background: rgba(10, 18, 33, 0.34);
        box-shadow: none;
        text-align: left;
        padding: 0.68rem 0.74rem;
    }

    .portfolio-page .eval-panel { display: block; }
    .portfolio-page .eval-panel .eval-status { margin-bottom: 0.22rem; font-size: 0.66rem; }
    .portfolio-page .eval-score { font-size: 1.82rem; margin: 0 0 0.24rem; }
    .portfolio-page .value-panel { align-items: flex-start; }
    .portfolio-page .value-amount { font-size: 1.34rem; margin: 0.16rem 0 0.08rem; }
    .portfolio-page .value-meta-note { font-size: 0.79rem; line-height: 1.42; }
    .portfolio-page .is-secondary-stat { padding: 0.62rem 0.7rem !important; }
    .portfolio-page .is-secondary-stat .value-amount { font-size: 1.08rem; }
    .portfolio-page .is-secondary-stat .detail-chip-row { gap: 0.3rem; }

    .portfolio-page .chart-container { padding: 0.84rem; border-radius: 12px; }
    .portfolio-page .estimate-header { flex-direction: column; align-items: flex-start; gap: 0.2rem; }

    .portfolio-page .estimate-section {
        margin: 0 0 0.8rem;
        border-radius: 10px;
        padding: 0.58rem;
    }

    .portfolio-page .estimate-grid { grid-template-columns: 1fr; gap: 0.42rem; }
    .portfolio-page .estimate-card { border-radius: 8px; padding: 0.42rem 0.48rem; background: transparent; border-left-width: 2px; }
    .portfolio-page .estimate-card .label { font-size: 0.65rem; }
    .portfolio-page .estimate-card .pct { font-size: 0.96rem; }
    .portfolio-page .estimate-card .val { font-size: 0.76rem; }
    .portfolio-page .estimate-card .cov { font-size: 0.68rem; }

    .portfolio-page .optimizer-section { margin: 0 0 0.85rem; }
    .portfolio-page .optimizer-title { margin: 0 0 0.55rem; }
    .portfolio-page .optimizer-grid { grid-template-columns: 1fr; gap: 0.45rem; }
    .portfolio-page .optimizer-card { border-radius: 8px; padding: 0.44rem 0.5rem; background: transparent; border-left-width: 2px; }
    .portfolio-page .optimizer-card .label { font-size: 0.65rem; }
    .portfolio-page .optimizer-card .value { font-size: 0.93rem; }
    .portfolio-page .optimizer-card .detail { font-size: 0.74rem; line-height: 1.4; }

    .portfolio-page .optimizer-suggestions {
        margin-top: 0.55rem;
        padding: 0.52rem 0.58rem;
        border-radius: 8px;
    }

    .portfolio-page .optimizer-suggestions ul {
        list-style: none;
        padding-left: 0;
    }

    .portfolio-page .optimizer-suggestions li {
        margin: 0.3rem 0;
        padding-left: 0;
        line-height: 1.46;
        font-size: 0.8rem;
    }

    .portfolio-page .optimizer-suggestions li.tone-good,
    .portfolio-page .optimizer-suggestions li.tone-warn,
    .portfolio-page .optimizer-suggestions li.tone-risk {
        padding-left: 0.48rem;
    }

    .portfolio-tax-page .accounting-summary-grid,
    .portfolio-tax-page .evaluator-detail-grid,
    .portfolio-tax-page .accounting-entry-form {
        grid-template-columns: 1fr;
    }

    .portfolio-evaluator-page .evaluator-detail-grid,
    .portfolio-evaluator-run-page .evaluator-detail-grid,
    .portfolio-evaluator-page .audit-step-list,
    .portfolio-evaluator-run-page .audit-step-list {
        grid-template-columns: 1fr;
    }

    .portfolio-evaluator-page .audit-holding-card,
    .portfolio-evaluator-run-page .audit-holding-card,
    .portfolio-evaluator-page .detail-card,
    .portfolio-evaluator-run-page .detail-card {
        padding: 0.84rem 0.88rem;
        border-radius: 14px;
    }

    .portfolio-evaluator-page .audit-holding-meta,
    .portfolio-evaluator-run-page .audit-holding-meta {
        justify-content: flex-start;
    }

    .portfolio-tax-page .summary-card,
    .portfolio-tax-page .detail-card {
        padding: 0.82rem 0.86rem;
        border-radius: 12px;
    }

    .portfolio-tax-page .summary-card .value {
        font-size: 1.1rem;
    }

    .portfolio-tax-page .field-action .btn-primary {
        width: 100%;
    }

    .portfolio-page .charts-grid { grid-template-columns: 1fr; gap: 0.65rem; margin-bottom: 0.85rem; }
    .portfolio-page .charts-grid .chart-container { border-radius: 10px; border-color: rgba(74,95,129,0.3); background: rgba(10,18,33,0.42); }
    .portfolio-page .chart-title { margin: 0 0 0.68rem; font-size: 0.68rem; }
    .portfolio-page .chart-canvas-wrap { height: 170px; }
    .portfolio-page .portfolio-settings { grid-template-columns: 1fr; gap: 0.75rem; }
    .portfolio-page .portfolio-settings input,
    .portfolio-page .portfolio-settings select { min-height: 44px; font-size: 0.96rem; }

    .portfolio-page .portfolio-settings .field-action {
        flex-direction: column;
        align-items: stretch;
        justify-content: flex-start;
    }

    .portfolio-page .portfolio-settings .field-action .btn-primary,
    .portfolio-page .portfolio-settings .field-action .btn-secondary { min-height: 46px; width: 100%; }

    .portfolio-page .add-stock-grid { grid-template-columns: 1fr; padding: 0.9rem; gap: 0.65rem; margin-bottom: 1rem; border-radius: 12px; }
    .portfolio-page .add-stock-grid .form-group label { font-size: 0.78rem; color: var(--text-secondary); }
    .portfolio-page .add-stock-grid input,
    .portfolio-page .add-stock-grid select { min-height: 44px; font-size: 0.98rem; }
    .portfolio-page .add-stock-grid .trade-assignment-status {
        grid-template-columns: 1fr;
        gap: 0.24rem;
    }

    .portfolio-page .add-stock-grid .trade-assignment-status a {
        white-space: normal;
    }

    .portfolio-page .add-stock-grid .trade-submit-group .btn-primary { width: 100%; min-height: 46px; }

    .portfolio-page .export-section {
        margin-top: 0.82rem;
        padding: 0.68rem;
        border-radius: 9px;
        border-color: rgba(74,95,129,0.26);
        background: transparent;
    }

    .portfolio-page .export-grid {
        display: grid;
        grid-template-columns: 1fr 1fr;
        align-items: stretch;
        gap: 0.5rem;
    }

    .portfolio-page .btn-export {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        text-align: center;
        min-height: 42px;
        padding: 0.56rem 0.6rem;
        font-size: 0.82rem;
        border-radius: 10px;
    }

    .portfolio-page .import-section {
        margin: 0.62rem 0 0.92rem;
        padding: 0.64rem 0.68rem;
        border-radius: 9px;
        border-color: rgba(74,95,129,0.26);
        background: transparent;
    }

    .portfolio-page .import-summary { font-size: 0.8rem; }
    .portfolio-page .tx-log-toolbar { grid-template-columns: 1fr; justify-items: stretch; }
    .portfolio-page .tx-log-summary { justify-content: flex-start; }
    .portfolio-page .modal-form-grid-fields { grid-template-columns: 1fr; }
    .portfolio-page .portfolio-settings.portfolio-settings-grid { grid-template-columns: 1fr; }
    .portfolio-page .import-body p { margin-bottom: 0.56rem; font-size: 0.83rem; line-height: 1.42; }
    .portfolio-page .import-grid { grid-template-columns: 1fr; }
    .portfolio-page .import-grid .import-assignment-status {
        grid-template-columns: 1fr;
        gap: 0.24rem;
    }
    .portfolio-page .import-grid .import-assignment-status a { white-space: normal; }
    .portfolio-page .import-replace { white-space: normal; justify-content: flex-start; }
    .portfolio-page .import-grid input[type="file"] { min-height: 44px; font-size: 0.9rem; }
    .portfolio-page .import-grid .btn-primary { width: 100%; min-height: 44px; }

    .portfolio-page .export-grid > div {
        margin-left: 0 !important;
        border-left: 0 !important;
        padding-left: 0 !important;
        width: 100%;
        display: grid !important;
        grid-template-columns: 1fr 1fr auto;
        gap: 0.5rem;
    }

    .portfolio-page .export-grid > div input { min-height: 42px; font-size: 0.88rem !important; }
    .portfolio-page .export-grid > div button { min-height: 42px; padding: 0.55rem 0.75rem !important; font-size: 0.82rem !important; }
    .portfolio-page .modal-content { width: min(94vw, 760px) !important; padding: 0.9rem; border-radius: 12px; max-height: calc(100vh - 1rem); margin: 0.5rem; }
    .portfolio-page .modal-head { position: sticky; top: -0.9rem; z-index: 2; padding: 0 0 0.64rem; margin-bottom: 0.68rem; background: linear-gradient(180deg, rgba(16, 27, 49, 0.98) 0%, rgba(16, 27, 49, 0.92) 100%); }
    .portfolio-page .modal-head.modal-head-wide { margin-bottom: 0.82rem; }
    .portfolio-page .tx-log-toolbar,
    .portfolio-page .tx-bulk-assign-form,
    .portfolio-page .tx-bulk-assign-controls { align-items: stretch; }
    .portfolio-page .tx-log-filter,
    .portfolio-page .tx-bulk-assign-copy,
    .portfolio-page .tx-bulk-assign-controls,
    .portfolio-page .tx-bulk-assign-controls select { width: 100%; min-width: 0; }
    .portfolio-page .modal-form .form-group { margin-bottom: 0.58rem; }
    .portfolio-page .modal-form .form-group:last-of-type { margin-bottom: 0; }
    .portfolio-page .portfolio-create-modal { width: min(96vw, 640px); }
    .portfolio-page .portfolio-wizard-main { padding: 1rem; }
    .portfolio-page .portfolio-wizard-option-grid,
    .portfolio-page .portfolio-wizard-option-grid-three { grid-template-columns: 1fr; }
    .portfolio-page .portfolio-wizard-option { min-height: 84px; }
    .portfolio-page .portfolio-wizard-actions { flex-wrap: wrap; }
    .portfolio-page .portfolio-wizard-actions .btn-primary,
    .portfolio-page .portfolio-wizard-actions .btn-secondary { min-width: calc(50% - 0.5rem); }
    .portfolio-page .portfolio-wizard-progress-step { padding: 0.32rem 0.48rem; }
    .portfolio-page .portfolio-wizard-progress-label { font-size: 0.71rem; }
    .portfolio-page .portfolio-wizard-name-field input { min-height: 60px; font-size: 1rem; }

    .portfolio-page .holdings-container {
        border: 1px solid rgba(74,95,129,0.32);
        background: rgba(8,14,26,0.4);
        margin: 0 0 0.72rem;
        overflow: hidden;
        border-radius: 10px;
    }

    .portfolio-page .holdings-table,
    .portfolio-page .holdings-table tbody,
    .portfolio-page .holdings-table tr { display: block; width: 100%; }

    .portfolio-page .holdings-table thead { display: none; }

    .portfolio-page .holdings-table tr {
        display: flex;
        flex-direction: column;
        margin-bottom: 0;
        border: 0;
        border-bottom: 1px solid rgba(74, 95, 129, 0.32);
        border-radius: 0;
        background: transparent;
        overflow: hidden;
        box-shadow: none;
    }

    .portfolio-page .holdings-table tr:last-child { border-bottom: 0; }

    .portfolio-page .holdings-table tr.holding-support-row {
        display: block;
        border-top: 0;
        border-bottom: 1px solid rgba(74, 95, 129, 0.22);
        background: rgba(255,255,255,0.015);
    }

    .portfolio-page .holdings-table td {
        display: flex !important;
        align-items: flex-start;
        justify-content: space-between;
        gap: 0.62rem;
        width: auto !important;
        box-sizing: border-box;
        padding: 0.58rem 0.68rem !important;
        border-bottom: 1px solid rgba(74,95,129,0.24);
        text-align: left !important;
        grid-template-columns: unset !important;
    }

    .portfolio-page .holdings-table td::before {
        content: attr(data-label);
        color: var(--text-muted);
        font-size: 0.66rem;
        letter-spacing: 0.06em;
        text-transform: uppercase;
        font-weight: 700;
        flex: 0 0 auto;
        padding-top: 0.14rem;
        min-width: 0;
    }

    .portfolio-page .holdings-table td > * {
        margin-left: auto;
        text-align: right;
        min-width: 0;
    }

    .portfolio-page .holdings-table td:first-child {
        display: block !important;
        padding: 0.74rem !important;
        border-bottom: 1px solid rgba(74,95,129,0.26);
        background: rgba(255,255,255,0.01);
    }

    .portfolio-page .holdings-table td:first-child::before { display: none !important; }
    .portfolio-page .holdings-table td:first-child > * { margin-left: 0; text-align: left; }
    .portfolio-page .holding-subline { font-size: 0.75rem; line-height: 1.36; gap: 0.36rem; }
    .portfolio-page .holding-native-currency { font-size: 0.66rem; }
    .portfolio-page .holdings-table td.holding-metric { font-size: 0.94rem; font-weight: 700; }

    .portfolio-page .holdings-table td.metric-value,
    .portfolio-page .holdings-table td.metric-pl { font-size: 0.98rem; }

    .portfolio-page .holdings-table td:last-child { border-bottom: 0; }
    .portfolio-page .holdings-table td.holding-support-cell {
        display: block !important;
        width: 100%;
        padding: 0.72rem 0.74rem 0.82rem !important;
        border-bottom: 0;
    }
    .portfolio-page .holdings-table td.holding-support-cell::before { display: none; content: none; }
    .portfolio-page .holdings-table td:first-child { order: 1; }
    .portfolio-page .holdings-table td.metric-value { order: 2; background: transparent; border-left: 0; }
    .portfolio-page .holdings-table td.metric-pl { order: 3; border-left: 0; background: transparent; }
    .portfolio-page .holdings-table td.metric-pl.buy { border-left: 0; background: transparent; }
    .portfolio-page .holdings-table td.metric-pl.sell { border-left: 0; background: transparent; }
    .portfolio-page .holdings-table td.holding-dividend-cell { order: 4; }

    .portfolio-page .holdings-table td.metric-amount,
    .portfolio-page .holdings-table td.metric-avg,
    .portfolio-page .holdings-table td.metric-price { display: none; }

    .portfolio-page .holdings-table td.holding-actions-cell { order: 5; }
    .portfolio-page .holding-row { cursor: default; }
    .portfolio-page .holdings-table td.holding-actions-cell::before { display: none; }
    .portfolio-page .holdings-table td.holding-actions-cell { padding-top: 0.5rem; border-top: 1px solid rgba(74,95,129,0.22); }
    .portfolio-page .holdings-table td.holding-actions-cell > * { margin-left: 0; text-align: left; }
    .portfolio-page .holdings-table td.holding-dividend-cell { align-items: flex-start; }
    .portfolio-page .holdings-table td.holding-dividend-cell > * { margin-left: 0; text-align: left; }
    .portfolio-page .holding-tax-strip { margin-top: 0.5rem; }
    .portfolio-page .holding-tax-chip { font-size: 0.66rem; padding: 0.2rem 0.48rem; min-height: 1.58rem; }
    .portfolio-page .holding-tax-note { font-size: 0.72rem; }
    .portfolio-page .holding-sector-strip { margin-top: 0.46rem; }
    .portfolio-page .holding-sector-chip { font-size: 0.66rem; padding: 0.2rem 0.48rem; min-height: 1.58rem; }
    .portfolio-page .holding-sector-note { font-size: 0.72rem; }
    .portfolio-page .holding-replacement-strip { margin-top: 0.45rem; }
    .portfolio-page .holding-replacement-chip { font-size: 0.66rem; padding: 0.2rem 0.48rem; min-height: 1.58rem; }
    .portfolio-page .holding-replacement-note { font-size: 0.72rem; }
    .portfolio-page .holding-support-grid { grid-template-columns: 1fr; gap: 0.5rem; }
    .portfolio-page .holding-support-panel { padding: 0.62rem 0.66rem; }

    .portfolio-page .action-stack {
        width: 100%;
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 0.42rem;
        align-items: stretch;
        justify-items: stretch;
    }

    .portfolio-page .action-stack .badge-mini,
    .portfolio-page .action-stack .action-btn {
        width: 100%;
        min-height: 42px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        text-align: center;
        font-size: 0.78rem;
        border-radius: 8px;
        border: 1px solid rgba(74,95,129,0.34);
        background: rgba(255,255,255,0.01);
        color: var(--text-secondary);
    }

    .portfolio-page .action-stack .history-btn { color: #e2ebf9; }
    .portfolio-page .action-stack .sell-btn { color: #fca5a5; border-color: rgba(239,68,68,0.34); }
    .portfolio-page .action-stack .move-open-btn { color: #bae6fd; border-color: rgba(56,189,248,0.34); }
    .portfolio-page .history-btn { grid-column: 1 / -1; }

    /* === Mobile: show quick-facts strip inside main cell === */
    .portfolio-page .holding-quick-facts {
        display: flex !important;
        align-items: center;
        flex-wrap: wrap;
        gap: 0;
        margin-top: 0.48rem;
        padding-top: 0.42rem;
        border-top: 1px solid rgba(51, 89, 127, 0.2);
    }
    .portfolio-page .holding-quick-fact {
        display: inline-flex;
        align-items: center;
        gap: 0.2rem;
        padding: 0 0.55rem 0 0;
        border: none;
        background: transparent;
        border-radius: 0;
    }
    .portfolio-page .holding-quick-fact + .holding-quick-fact {
        padding-left: 0.55rem;
        border-left: 1px solid rgba(51, 89, 127, 0.28);
    }
    .portfolio-page .holding-quick-fact-label {
        font-size: 0.58rem;
        font-weight: 700;
        text-transform: uppercase;
        letter-spacing: 0.06em;
        color: var(--text-muted);
        white-space: nowrap;
    }
    .portfolio-page .holding-quick-fact-value {
        font-size: 0.72rem;
        font-weight: 700;
        color: var(--text-secondary);
    }

    /* === Mobile: tax toggle touch targets === */
    .portfolio-page .holding-tax-toggle .htb {
        height: 26px;
        font-size: 0.63rem;
        padding: 0 0.55rem;
    }

    /* === Mobile: holding-id-row + holding-tax-row sizing === */
    .portfolio-page .holding-id-row {
        gap: 0.24rem;
        flex-wrap: wrap;
    }
    .portfolio-page .holding-company-name {
        font-size: 0.74rem;
    }
    .portfolio-page .holding-sector-tag {
        font-size: 0.62rem;
    }
    .portfolio-page .holding-tax-row {
        gap: 0.28rem;
        margin-top: 0.02rem;
    }

    /* === Mobile: decision line chips slightly larger === */
    .portfolio-page .holding-decision-line {
        gap: 0.32rem;
        margin-top: 0.52rem;
    }
    .portfolio-page .holding-decision-line .signal-badge,
    .portfolio-page .holding-decision-line .holding-return-chip {
        font-size: 0.72rem;
    }

    /* === Mobile: hsp panel adjustments === */
    .portfolio-page .hsp-head {
        flex-wrap: wrap;
        gap: 0.28rem;
    }
    .portfolio-page .hsp-type-tag {
        font-size: 0.57rem;
        padding-right: 0.36rem;
    }
    .portfolio-page .hsp-primary-text {
        font-size: 0.72rem;
    }
    .portfolio-page .hsp-amount {
        font-size: 0.7rem;
    }
    .portfolio-page .hsp-chips {
        margin-top: 0.24rem;
        gap: 0.2rem;
    }
    .portfolio-page .hsp-detail-row {
        margin-top: 0.22rem;
        font-size: 0.66rem;
    }
    .portfolio-page .hsp-notes {
        margin-top: 0.22rem;
        font-size: 0.66rem;
    }

    .portfolio-page .export-custom-range {
        grid-column: 1 / -1;
        margin-left: 0;
        border-left: 0;
        padding-left: 0;
        display: grid;
        grid-template-columns: 1fr 1fr auto;
        width: 100%;
    }

    .portfolio-page .export-input { min-height: 42px; box-sizing: border-box; }
    .portfolio-page .export-custom-btn { min-height: 42px; }

    .portfolio-page .modal-actions {
        flex-direction: column;
        gap: 0.65rem;
    }
}

/* Tablet: value + P/L side-by-side */
@media (min-width: 480px) and (max-width: 900px) {
    .portfolio-page .holdings-table tr.holding-row {
        display: grid;
        grid-template-columns: 1fr 1fr;
    }
    .portfolio-page .holdings-table tr.holding-row td:first-child,
    .portfolio-page .holdings-table tr.holding-row td.holding-dividend-cell,
    .portfolio-page .holdings-table tr.holding-row td.holding-actions-cell {
        grid-column: 1 / -1;
    }
    .portfolio-page .holdings-table tr.holding-row td.metric-value {
        grid-column: 1;
        border-right: 1px solid rgba(74, 95, 129, 0.18);
    }
    .portfolio-page .holdings-table tr.holding-row td.metric-pl {
        grid-column: 2;
    }
}

@media (max-width: 640px) {
    .portfolio-page { padding-top: 0.7rem; }
    .portfolio-page .portfolio-toolbar { padding: 0.64rem; }
    .portfolio-page .currency-form { flex-direction: column; align-items: stretch; gap: 0.35rem; }
    .portfolio-page .currency-form label { font-size: 0.66rem; }
    .portfolio-page .export-grid { grid-template-columns: 1fr; }
    .portfolio-page .export-custom-range { grid-template-columns: 1fr; }
    .portfolio-page .estimate-grid { grid-template-columns: 1fr; }
    .portfolio-page .dividend-event-row { flex-direction: column; gap: 0.35rem; }
    .portfolio-page .dividend-event-amount { text-align: left; }
    .portfolio-page .holdings-table td { padding: 0.56rem 0.58rem; }
    .portfolio-page .holdings-table td::before { font-size: 0.62rem; }
    .portfolio-page .holdings-table td.holding-actions-cell { padding-top: 0.6rem; }
    /* Hide next-dividend event detail on small screens — too dense */
    .portfolio-page .holding-dividend-next { display: none; }
    .portfolio-page .import-grid input[type="file"] { font-size: 0.86rem; }
}

@media (max-width: 430px) {
    .portfolio-page .p-nav-item { padding: 0.58rem 0.66rem 0.58rem 0.72rem; }
    .portfolio-page .p-nav-name { font-size: 0.78rem; }
    .portfolio-page .top-stats { padding: 0; }
    .portfolio-page .eval-panel { display: block; }

    .portfolio-page .eval-panel,
    .portfolio-page .value-panel { padding: 0.58rem 0.64rem; }

    .portfolio-page .charts-grid { gap: 0.58rem; }
    .portfolio-page .chart-container { padding: 0.76rem; }
    .portfolio-page .chart-canvas-wrap { height: 146px; }

    .portfolio-page .export-section,
    .portfolio-page .import-section { padding: 0.64rem; border-radius: 9px; }

    .portfolio-page .eval-score { font-size: 1.66rem; }
    .portfolio-page .value-amount { font-size: 1.22rem; }
    .portfolio-page .portfolio-title { font-size: 0.98rem; }
    .portfolio-page .holding-subline { font-size: 0.72rem; }
    .portfolio-page .portfolio-chip { font-size: 0.64rem; }

    /* Holdings: tighten main cell padding */
    .portfolio-page .holdings-table td:first-child { padding: 0.64rem 0.62rem; }

    /* Holdings: hide sector tag if it makes the id-row wrap badly */
    .portfolio-page .holding-sector-tag { display: none; }

    /* Holdings: compact quick-facts */
    .portfolio-page .holding-quick-fact-value { font-size: 0.68rem; }
    .portfolio-page .holding-quick-fact-label { font-size: 0.56rem; }
    .portfolio-page .holding-quick-fact + .holding-quick-fact { padding-left: 0.44rem; }
    .portfolio-page .holding-quick-fact { padding-right: 0.44rem; }

    /* Holdings: dividend cell — just the paid total, hide expected 12m */
    .portfolio-page .holding-dividend-meta:last-of-type { display: none; }

    .portfolio-page .portfolio-settings input,
    .portfolio-page .portfolio-settings select,
    .portfolio-page .add-stock-grid input,
    .portfolio-page .add-stock-grid select {
        min-height: 42px;
        padding: 0.58rem;
    }

    .portfolio-page .add-stock-grid .trade-submit-group .btn-primary,
    .portfolio-page .portfolio-settings .field-action .btn-primary { min-height: 44px; }

    .portfolio-page .btn-export { min-height: 40px; padding: 0.55rem 0.64rem; font-size: 0.79rem; }
    .portfolio-page .export-grid > div { grid-template-columns: 1fr; gap: 0.42rem; }
    .portfolio-page .export-custom-btn { width: 100%; }
    .portfolio-page .modal-content { width: 95vw !important; padding: 0.72rem; margin: 0.35rem; }
    .portfolio-page .modal-head { top: -0.72rem; }
    .portfolio-page .action-stack { grid-template-columns: 1fr; }
}

/* ── Portfolio mobile: sidebar AI section hidden, holdings layout fixed ── */
@media (max-width: 900px) {
    /* Hide AI agent cards on mobile — sidebar is a compact horizontal scroller;
       the tall agent section breaks the layout by stretching the sidebar height */
    .sidebar-agents-section {
        display: none !important;
    }

    /* Hide the dividend column on mobile — too dense, not actionable on small screens */
    .portfolio-page .holdings-table td.holding-dividend-cell,
    .portfolio-page .holdings-table th.th-dividend {
        display: none !important;
    }

    /* High-specificity override for the holdings table cells.
       The table has class="market-table holdings-table", so using both class names
       gives 3 classes (> 2 classes on the generic rules) — wins even with !important. */
    .portfolio-page .holdings-table.market-table td {
        display: flex !important;
        flex-direction: row !important;
        align-items: flex-start !important;
        justify-content: space-between !important;
        gap: 0.62rem !important;
        padding: 0.58rem 0.68rem !important;
        box-sizing: border-box !important;
        text-align: left !important;
        grid-template-columns: unset !important;
        width: 100% !important;
    }
    .portfolio-page .holdings-table.market-table td::before {
        flex: 0 0 auto !important;
        min-width: 4.8rem !important;
        font-size: 0.63rem !important;
        letter-spacing: 0.06em !important;
        text-transform: uppercase !important;
        font-weight: 700 !important;
        color: var(--text-muted) !important;
        padding-top: 0.14rem !important;
    }
    .portfolio-page .holdings-table.market-table td > * {
        margin-left: auto !important;
        text-align: right !important;
        min-width: 0 !important;
    }
    .portfolio-page .holdings-table.market-table td:first-child {
        display: block !important;
        padding: 0.74rem !important;
        border-bottom: 1px solid rgba(74,95,129,0.26) !important;
    }
    .portfolio-page .holdings-table.market-table td:first-child::before {
        display: none !important;
    }
    .portfolio-page .holdings-table.market-table td:first-child > * {
        margin-left: 0 !important;
        text-align: left !important;
    }
    /* Hide the 3 numeric metric columns — already handled by quick-facts on desktop */
    .portfolio-page .holdings-table.market-table td.metric-amount,
    .portfolio-page .holdings-table.market-table td.metric-avg,
    .portfolio-page .holdings-table.market-table td.metric-price {
        display: none !important;
    }
    /* Support rows span full width */
    .portfolio-page .holdings-table.market-table td.holding-support-cell {
        display: block !important;
        width: 100% !important;
    }
}

@media (max-width: 900px) {
    header {
        border-bottom-color: rgba(51, 89, 127, 0.26) !important;
    }

    .header-inner {
        min-height: 60px !important;
        gap: 0.5rem !important;
        padding: 0 0.72rem !important;
    }

    .mobile-top-actions {
        gap: 0.32rem !important;
    }

    .mobile-menu-toggle,
    .mobile-auth-shortcut,
    .mobile-lang-shortcut {
        min-height: 40px !important;
    }

    .mobile-menu-toggle {
        width: 40px;
        height: 40px;
        border-radius: 11px !important;
    }

    .stock-detail-page .stock-insight-card {
        padding: 0.72rem !important;
        border-radius: 11px !important;
    }

    .stock-detail-page .stock-insight-card h2 {
        font-size: 0.84rem;
        margin-bottom: 0.42rem;
    }

    .stock-detail-page .insight-meta {
        margin: 0.08rem 0 0.42rem;
        font-size: 0.72rem;
        line-height: 1.4;
    }

    .stock-detail-page .score-matrix {
        gap: 0.28rem;
    }

    .stock-detail-page .score-head {
        font-size: 0.6rem;
    }

    .stock-detail-page .score-label {
        font-size: 0.72rem;
    }

    .stock-detail-page .score-cell {
        padding: 0.32rem 0.28rem;
        font-size: 0.74rem;
    }

    .stock-detail-page .projection-grid {
        gap: 0.36rem;
    }

    .stock-detail-page .projection-row {
        padding: 0.42rem 0.5rem;
        gap: 0.12rem 0.5rem;
    }

    .stock-detail-page .projection-label {
        font-size: 0.71rem;
    }

    .stock-detail-page .projection-price {
        font-size: 0.8rem;
    }

    .stock-detail-page .projection-meta,
    .stock-detail-page .projection-range {
        font-size: 0.68rem;
        line-height: 1.32;
    }

    .stock-detail-page .dividend-summary-grid,
    .stock-detail-page .dividend-metrics {
        gap: 0.34rem;
    }

    .stock-detail-page .metric-box {
        padding: 0.4rem 0.42rem;
        border-radius: 9px;
    }

    .stock-detail-page .metric-box span {
        font-size: 0.64rem;
    }

    .stock-detail-page .metric-box strong {
        font-size: 0.82rem;
    }

    .stock-detail-page .insight-kv {
        padding: 0.32rem 0;
        font-size: 0.78rem;
        gap: 0.5rem;
    }

    .stock-detail-page .dividend-toggle-wrap {
        margin-top: 0.62rem;
    }

    .stock-detail-page .stock-facts-grid {
        gap: 0.38rem;
    }

    .stock-detail-page .stock-fact-card {
        padding: 0.58rem 0.62rem;
        border-radius: 10px;
    }

    .stock-detail-page .related-sector-section {
        margin-top: 1rem;
        padding-top: 0.8rem;
    }
}

@media (max-width: 640px) {
    .header-inner {
        min-height: 58px !important;
        padding: 0 0.64rem !important;
    }

    .logo {
        font-size: 0.98rem !important;
    }

    .beta-tag {
        font-size: 0.54rem;
        padding: 0.12rem 0.3rem;
    }

    .mobile-auth-shortcut,
    .mobile-lang-shortcut {
        min-width: 0;
        padding: 0.3rem 0.5rem;
        font-size: 0.7rem;
    }

    .stock-detail-page .stock-signal-summary {
        grid-template-columns: 1fr;
    }

    .stock-detail-page .stock-summary-item:last-child {
        grid-column: auto;
    }
}

.stock-mobile-details {
    display: block;
    margin: 0;
}

.stock-mobile-summary {
    display: none;
}

.stock-mobile-details > summary::-webkit-details-marker {
    display: none;
}

.stock-mobile-details .stock-insight-card-collapsible {
    margin: 0;
}

@media (max-width: 900px) {
    .stock-detail-page .stock-mobile-details {
        border: 1px solid rgba(92, 116, 147, 0.36);
        border-radius: 12px;
        background: rgba(8, 14, 26, 0.54);
        overflow: hidden;
    }

    .stock-detail-page .stock-mobile-summary {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 0.5rem;
        list-style: none;
        cursor: pointer;
        padding: 0.78rem 0.82rem;
        color: var(--text-primary);
        font-size: 0.82rem;
        font-weight: 800;
        letter-spacing: -0.01em;
    }

    .stock-detail-page .stock-mobile-summary::after {
        content: "+";
        color: var(--text-secondary);
        font-size: 1rem;
        line-height: 1;
    }

    .stock-detail-page .stock-mobile-details[open] > .stock-mobile-summary::after {
        content: "-";
    }

    .stock-detail-page .stock-mobile-details .stock-insight-card-collapsible {
        border: 0 !important;
        background: transparent !important;
        box-shadow: none !important;
        border-radius: 0 !important;
        padding: 0 0.82rem 0.82rem !important;
    }

    .stock-detail-page .stock-mobile-details .stock-insight-card-collapsible h2 {
        display: none;
    }
}

.mobile-collapse-details {
    display: block;
    margin: 0;
}

.mobile-collapse-summary {
    display: none;
}

.mobile-collapse-details > summary::-webkit-details-marker {
    display: none;
}

@media (max-width: 900px) {
    .public-portfolio-page .public-mobile-details {
        border: 1px solid rgba(92, 116, 147, 0.36);
        border-radius: 12px;
        background: rgba(8, 14, 26, 0.54);
        overflow: hidden;
        margin-top: 0.9rem;
    }

    .public-portfolio-page .public-mobile-summary {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 0.5rem;
        list-style: none;
        cursor: pointer;
        padding: 0.78rem 0.82rem;
        color: var(--text-primary);
        font-size: 0.82rem;
        font-weight: 800;
        letter-spacing: -0.01em;
    }

    .public-portfolio-page .public-mobile-summary::after {
        content: "+";
        color: var(--text-secondary);
        font-size: 1rem;
        line-height: 1;
    }

    .public-portfolio-page .public-mobile-details[open] > .public-mobile-summary::after {
        content: "-";
    }

    .public-portfolio-page .public-mobile-details > .portfolio-income-section,
    .public-portfolio-page .public-mobile-details > .chart-container {
        margin-top: 0 !important;
        border: 0 !important;
        background: transparent !important;
        box-shadow: none !important;
        border-radius: 0 !important;
    }

    .public-portfolio-page .public-mobile-details > .portfolio-income-section {
        padding: 0 0.82rem 0.82rem !important;
    }

    .public-portfolio-page .public-mobile-details > .chart-container {
        padding: 0.2rem 0.82rem 0.82rem !important;
    }
}

@media (max-width: 900px) {
    .portfolio-page .portfolio-mobile-details {
        border: 1px solid rgba(92, 116, 147, 0.36);
        border-radius: 12px;
        background: rgba(8, 14, 26, 0.54);
        overflow: hidden;
        margin-top: 0.9rem;
    }

    .portfolio-page .portfolio-mobile-summary {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 0.5rem;
        list-style: none;
        cursor: pointer;
        padding: 0.78rem 0.82rem;
        color: var(--text-primary);
        font-size: 0.82rem;
        font-weight: 800;
        letter-spacing: -0.01em;
    }

    .portfolio-page .portfolio-mobile-summary::after {
        content: "+";
        color: var(--text-secondary);
        font-size: 1rem;
        line-height: 1;
    }

    .portfolio-page .portfolio-mobile-details[open] > .portfolio-mobile-summary::after {
        content: "-";
    }

    .portfolio-page .portfolio-mobile-details > .portfolio-income-section,
    .portfolio-page .portfolio-mobile-details > .estimate-section,
    .portfolio-page .portfolio-mobile-details > .optimizer-section,
    .portfolio-page .portfolio-mobile-details > .charts-grid,
    .portfolio-page .portfolio-mobile-details > .export-section {
        margin-top: 0 !important;
        margin-bottom: 0 !important;
        border: 0 !important;
        background: transparent !important;
        box-shadow: none !important;
        border-radius: 0 !important;
    }

    .portfolio-page .portfolio-mobile-details > .portfolio-income-section,
    .portfolio-page .portfolio-mobile-details > .estimate-section,
    .portfolio-page .portfolio-mobile-details > .optimizer-section,
    .portfolio-page .portfolio-mobile-details > .export-section {
        padding: 0 0.82rem 0.82rem !important;
    }

    .portfolio-page .portfolio-mobile-details > .charts-grid {
        padding: 0.2rem 0.82rem 0.82rem !important;
    }

    .portfolio-page .portfolio-mobile-details > .charts-grid .chart-container {
        border-radius: 10px;
    }
}

@media (max-width: 900px) {
    .header-inner {
        min-height: 54px !important;
        gap: 0.4rem !important;
        padding: 0 0.56rem !important;
    }

    .logo {
        font-size: 0.96rem !important;
        letter-spacing: 0.08em !important;
    }

    .beta-tag {
        padding: 0.08rem 0.3rem !important;
        font-size: 0.54rem !important;
    }

    .mobile-top-actions {
        gap: 0.24rem !important;
    }

    .mobile-menu-toggle,
    .mobile-auth-shortcut,
    .mobile-lang-shortcut {
        min-height: 36px !important;
        border-radius: 10px !important;
    }

    .mobile-menu-toggle {
        width: 36px !important;
        height: 36px !important;
    }

    .mobile-auth-shortcut {
        width: 36px;
        min-width: 36px !important;
        padding: 0 !important;
    }

    .mobile-shortcut-icon {
        width: 17px;
        height: 17px;
        stroke: currentColor;
        stroke-width: 1.9;
        fill: none;
        stroke-linecap: round;
        stroke-linejoin: round;
    }

    .mobile-lang-shortcut {
        min-width: 38px !important;
        padding: 0 0.44rem !important;
        font-size: 0.68rem !important;
    }

    .main-nav {
        width: min(90vw, 320px) !important;
        max-width: min(90vw, 320px) !important;
        padding: 0.78rem 0.78rem 0.9rem !important;
    }

    .nav-mobile-head {
        margin: 0 0 0.45rem !important;
    }

    .nav-mobile-auth {
        margin-bottom: 0.62rem !important;
        gap: 0.45rem !important;
    }

    .nav-mobile-auth .nav-mobile-auth-btn {
        min-height: 42px !important;
        font-size: 0.81rem !important;
    }

    .nav-links {
        gap: 0.42rem !important;
    }

    .nav-link {
        min-height: 44px !important;
        padding: 0.62rem 0.72rem !important;
        border-radius: 12px !important;
    }

    .nav-link-text {
        font-size: 0.84rem !important;
    }

    .nav-link-icon {
        width: 18px !important;
        height: 18px !important;
    }

    .nav-utils {
        gap: 0.58rem !important;
    }

    .header-stock-search input {
        min-height: 42px !important;
        font-size: 0.88rem !important;
    }

    .lang-switcher a {
        min-height: 38px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }
}

@media (max-width: 640px) {
    .header-inner {
        min-height: 52px !important;
        padding: 0 0.5rem !important;
    }

    .logo {
        font-size: 0.9rem !important;
    }

    .mobile-menu-toggle,
    .mobile-auth-shortcut,
    .mobile-lang-shortcut {
        min-height: 34px !important;
    }

    .mobile-menu-toggle,
    .mobile-auth-shortcut {
        width: 34px !important;
        min-width: 34px !important;
    }

    .mobile-lang-shortcut {
        min-width: 36px !important;
    }

    .main-nav {
        width: min(92vw, 300px) !important;
    }
}

@media (min-width: 901px) {
    .header-inner {
        min-height: 66px !important;
        gap: 0.75rem !important;
        padding: 0 clamp(0.95rem, 1.8vw, 1.35rem) !important;
    }

    .logo {
        font-size: 1rem !important;
    }

    .main-nav {
        margin-left: 1.35rem !important;
    }

    .nav-links {
        gap: 0.38rem !important;
    }

    .nav-link {
        min-height: 38px;
        padding: 0.48rem 0.76rem;
    }

    .header-stock-search {
        width: min(228px, 29vw) !important;
    }

    .header-stock-search input {
        min-height: 42px !important;
    }

    .nav-btn,
    .btn-primary,
    .btn-secondary,
    .btn-export {
        min-height: 42px;
        padding: 0.6rem 0.9rem;
    }

    .nav-btn-icon {
        width: 42px;
        min-width: 42px;
    }

    .directory-header,
    .home-v2-hero,
    .home-v2-conversion,
    .home-v2-block,
    .entry-conversion {
        padding: 1.2rem 1.3rem;
    }

    .directory-header > * + * {
        margin-top: 0.55rem;
    }

    .directory-header h1,
    .stock-detail-page .directory-header h1,
    .portfolio-page .directory-header h1,
    .public-portfolio-page .directory-header h1 {
        font-size: clamp(1.65rem, 2.5vw, 2.35rem) !important;
    }

    .directory-header .subtitle,
    .public-portfolio-page .directory-header .subtitle,
    .stock-detail-page .directory-header .subtitle {
        font-size: 0.9rem;
        line-height: 1.5;
    }

    .stock-detail-page .stock-detail-header {
        padding-bottom: 0.7rem;
        gap: 0.72rem;
    }

    .stock-detail-page .stock-decision-hero {
        gap: 0.85rem;
    }

    .stock-detail-page .stock-decision-copy {
        gap: 0.4rem;
    }

    .stock-detail-page .stock-signal-summary {
        gap: 0.62rem;
        margin-top: 0.8rem;
    }

    .stock-detail-page .stock-summary-item {
        padding: 0.82rem 0.9rem;
    }

    .stock-detail-page .stock-insights-grid {
        gap: 0.8rem;
    }

    .stock-detail-page .stock-insight-card {
        padding: 1rem;
    }

    .stock-detail-page .stock-detail-actions {
        margin: 0.8rem 0 0;
        gap: 0.62rem;
    }

    .stock-detail-page .related-sector-section {
        margin-top: 1rem;
        padding-top: 0.8rem;
    }

    .portfolio-page .portfolio-toolbar,
    .public-portfolio-page .directory-header.split-header {
        gap: 0.72rem;
        margin-bottom: 0.8rem;
    }

    .portfolio-page .top-stats,
    .public-portfolio-page .top-stats {
        gap: 0.75rem;
        margin-bottom: 0.8rem;
    }

    .portfolio-page .top-stats-primary,
    .public-portfolio-page .top-stats-primary {
        grid-template-columns: repeat(auto-fit, minmax(225px, 1fr));
    }

    .portfolio-page .top-stats-secondary,
    .public-portfolio-page .top-stats-secondary {
        grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
        margin-top: 0.65rem;
    }

    .portfolio-page .eval-panel,
    .portfolio-page .value-panel,
    .public-portfolio-page .eval-panel,
    .public-portfolio-page .value-panel {
        min-height: 0;
        padding: 1.15rem !important;
    }

    .portfolio-priority-banner,
    .public-portfolio-priority {
        gap: 0.62rem;
        padding: 0.76rem 0.86rem;
        margin: 0 0 0.72rem;
    }

    .portfolio-priority-copy p,
    .public-portfolio-priority-copy p {
        margin-top: 0.18rem;
    }

    .portfolio-priority-meta,
    .public-portfolio-priority-meta,
    .public-portfolio-header-meta {
        gap: 0.34rem;
    }

    .portfolio-priority-chip,
    .public-portfolio-priority-chip,
    .public-portfolio-header-chip,
    .portfolio-chip {
        min-height: 28px;
        padding: 0.24rem 0.54rem;
        font-size: 0.71rem;
    }

    .portfolio-page .portfolio-toolbar,
    .portfolio-page .estimate-section,
    .portfolio-page .optimizer-section,
    .portfolio-page .charts-grid,
    .portfolio-page .holdings-container,
    .portfolio-page .export-section,
    .portfolio-page .import-section,
    .portfolio-page .portfolio-income-section,
    .public-portfolio-page .portfolio-income-section,
    .public-portfolio-page .public-holdings-container,
    .public-portfolio-page .chart-container {
        margin-top: 0.8rem;
    }

    .portfolio-page .chart-container,
    .public-portfolio-page .chart-container {
        padding: 1rem !important;
    }

    .portfolio-page .dividend-summary-grid,
    .public-portfolio-page .dividend-summary-grid {
        gap: 0.62rem;
    }

    .portfolio-page .dividend-summary-card,
    .public-portfolio-page .dividend-summary-card {
        min-height: 120px;
        padding: 0.9rem 0.95rem !important;
    }

    .portfolio-page .dividend-event-list,
    .portfolio-page .dividend-history-dropdown,
    .public-portfolio-page .dividend-event-list,
    .public-portfolio-page .dividend-history-dropdown {
        margin-top: 0.62rem;
    }
}

/* Final evaluator layout override: keep audit sections readable and stop inherited multi-column card density from collapsing long content. */
.portfolio-evaluator-page .evaluator-holdings-section .audit-holding-header,
.portfolio-evaluator-run-page .evaluator-holdings-section .audit-holding-header {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) !important;
    align-items: start !important;
    gap: 0.7rem !important;
}

.portfolio-evaluator-page .evaluator-holdings-section .audit-holding-meta,
.portfolio-evaluator-run-page .evaluator-holdings-section .audit-holding-meta,
.portfolio-evaluator-page .evaluator-holdings-section .detail-chip-row,
.portfolio-evaluator-run-page .evaluator-holdings-section .detail-chip-row {
    justify-content: flex-start !important;
    align-items: flex-start !important;
}

.portfolio-evaluator-page .evaluator-holdings-section .audit-step-list,
.portfolio-evaluator-run-page .evaluator-holdings-section .audit-step-list {
    grid-template-columns: minmax(0, 1fr) !important;
    gap: 0.68rem !important;
}

.portfolio-evaluator-page .evaluator-holdings-section .audit-step-row,
.portfolio-evaluator-run-page .evaluator-holdings-section .audit-step-row {
    grid-column: auto !important;
    min-width: 0 !important;
    width: 100% !important;
    padding: 0.8rem 0.85rem !important;
}

.portfolio-evaluator-page .evaluator-holdings-section .audit-step-row-title,
.portfolio-evaluator-page .evaluator-holdings-section .audit-step-row-value,
.portfolio-evaluator-page .evaluator-holdings-section .audit-step-row-detail,
.portfolio-evaluator-run-page .evaluator-holdings-section .audit-step-row-title,
.portfolio-evaluator-run-page .evaluator-holdings-section .audit-step-row-value,
.portfolio-evaluator-run-page .evaluator-holdings-section .audit-step-row-detail {
    max-width: 100% !important;
    white-space: normal !important;
    overflow-wrap: anywhere !important;
    word-break: break-word !important;
}

.portfolio-evaluator-page .evaluator-holdings-section .audit-step-row-candidates .audit-step-inline-meta,
.portfolio-evaluator-run-page .evaluator-holdings-section .audit-step-row-candidates .audit-step-inline-meta {
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 0.4rem !important;
}

.portfolio-evaluator-page .evaluator-holdings-section .audit-step-row-candidates .audit-step-row-detail,
.portfolio-evaluator-run-page .evaluator-holdings-section .audit-step-row-candidates .audit-step-row-detail {
    line-height: 1.55 !important;
}

@media (max-width: 900px) {
    .portfolio-evaluator-page .evaluator-detail-grid,
    .portfolio-evaluator-run-page .evaluator-detail-grid {
        grid-template-columns: minmax(0, 1fr) !important;
    }

    .portfolio-evaluator-page .evaluator-holdings-section .audit-holding-card,
    .portfolio-evaluator-run-page .evaluator-holdings-section .audit-holding-card {
        padding: 0.82rem 0.84rem !important;
    }
}

/* Final main portfolio holdings override: keep the ticker cell readable and stop support strips from collapsing the table. */
@media (min-width: 901px) {
    .portfolio-page .holdings-table {
        table-layout: fixed;
    }

    .portfolio-page .holdings-container {
        border-color: rgba(60, 88, 118, 0.26);
    }

    .portfolio-page .holdings-header {
        padding: 0.95rem 1.05rem 0.8rem;
    }

    .portfolio-page .holding-row.has-support > td {
        border-bottom: 0;
    }

    .portfolio-page .holding-support-row td.holding-support-cell {
        padding: 0.12rem 0.92rem 0.72rem;
        border-bottom: 1px solid rgba(51, 89, 127, 0.22);
        background: rgba(255,255,255,0.01);
    }

    .portfolio-page .holding-support-row:last-child td.holding-support-cell {
        border-bottom: 0;
    }

    .portfolio-page .holdings-table th,
    .portfolio-page .holdings-table td {
        vertical-align: top;
    }

    .portfolio-page .holdings-table td.holding-main-cell {
        width: 27%;
        min-width: 0;
    }

    .portfolio-page .holdings-table td.holding-dividend-cell {
        width: 10.8rem;
    }

    .portfolio-page .holdings-table td.metric-amount,
    .portfolio-page .holdings-table td.metric-avg,
    .portfolio-page .holdings-table td.metric-price {
        width: 6.2rem;
        white-space: nowrap;
    }

    .portfolio-page .holdings-table td.metric-value,
    .portfolio-page .holdings-table td.metric-pl {
        width: 8.1rem;
        white-space: nowrap;
    }

    .portfolio-page .holdings-table td.holding-actions-cell {
        width: 7.9rem;
    }

    .portfolio-page .holding-support-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 0.95rem;
        align-items: start;
    }

    .portfolio-page .holding-support-panel {
        padding: 0;
        border: 0;
        border-radius: 0;
        background: transparent;
        min-height: 0;
    }

    .portfolio-page .holding-support-panel + .holding-support-panel {
        padding-left: 0.95rem;
        border-left: 1px solid rgba(60, 88, 118, 0.22);
    }

    .portfolio-page .holding-support-label {
        margin-bottom: 0.22rem;
        font-size: 0.55rem;
        letter-spacing: 0.1em;
    }

    .portfolio-page .holding-tax-chip,
    .portfolio-page .holding-sector-chip,
    .portfolio-page .holding-replacement-chip {
        min-height: 1.34rem;
        padding: 0.1rem 0.38rem;
        font-size: 0.61rem;
    }

    .portfolio-page .holding-main-cell > * {
        max-width: 100%;
        min-width: 0;
    }

    .portfolio-page .holding-support-cell::before {
        display: none !important;
        content: none !important;
    }

    .portfolio-page .ticker-line {
        display: flex;
        align-items: center;
        flex-wrap: wrap;
        gap: 0.35rem;
    }

    .portfolio-page .holding-subline,
    .portfolio-page .holding-tax-note,
    .portfolio-page .holding-sector-note,
    .portfolio-page .holding-replacement-note {
        max-width: 100%;
        overflow-wrap: anywhere;
        word-break: break-word;
    }

    .portfolio-page .holding-tax-strip,
    .portfolio-page .holding-sector-strip,
    .portfolio-page .holding-replacement-strip {
        max-width: 100%;
    }

    .portfolio-page .holding-replacement-note,
    .portfolio-page .holding-sector-note,
    .portfolio-page .holding-tax-note {
        font-size: 0.7rem;
        line-height: 1.34;
    }

    .portfolio-page .holding-dividend-summary {
        align-items: flex-end;
    }

    .portfolio-page .action-stack {
        justify-content: flex-end;
        align-items: flex-start;
        gap: 0.38rem;
    }
}

@media (max-width: 900px) {
    .portfolio-page .holdings-header {
        padding: 0.78rem 0.8rem 0.68rem;
        align-items: center;
    }

    .portfolio-page .holdings-header-copy h3 {
        font-size: 0.84rem;
    }

    .portfolio-page .holdings-table td.holding-main-cell {
        display: block !important;
        padding: 0.78rem 0.74rem !important;
    }

    .portfolio-page .holding-main-cell > * {
        max-width: 100%;
        min-width: 0;
    }

    .portfolio-page .holding-tax-note,
    .portfolio-page .holding-sector-note,
    .portfolio-page .holding-replacement-note,
    .portfolio-page .holding-subline {
        overflow-wrap: anywhere;
        word-break: break-word;
    }

    .portfolio-page .holding-tax-strip,
    .portfolio-page .holding-sector-strip,
    .portfolio-page .holding-replacement-strip {
        gap: 0.3rem;
    }
}

.model-portfolio-page {
    --model-cyan: #38bdf8;
    --model-rose: #f472b6;
    --model-gold: #fbbf24;
    --model-surface: rgba(10, 18, 33, 0.72);
    --model-surface-strong: rgba(13, 22, 38, 0.9);
    --model-border: rgba(116, 142, 178, 0.16);
}

.model-portfolio-page .directory-header {
    align-items: flex-start;
    display: grid;
    grid-template-columns: minmax(0, 1.2fr) auto;
    gap: 18px;
    padding: 24px;
    margin: 1rem 0 1.15rem;
    border: 1px solid rgba(110, 142, 184, 0.28);
    border-radius: 26px;
    background:
        radial-gradient(circle at top right, rgba(56, 189, 248, 0.12) 0%, rgba(56, 189, 248, 0) 34%),
        linear-gradient(145deg, rgba(8, 16, 30, 0.96), rgba(6, 12, 23, 0.92));
    box-shadow: 0 20px 38px rgba(0, 0, 0, 0.26);
}

.model-portfolio-page .directory-header {
    position: relative;
    overflow: hidden;
}

.model-portfolio-page .directory-header::before {
    content: "";
    position: absolute;
    inset: 0 auto 0 0;
    width: 6px;
    border-radius: 26px 0 0 26px;
    background: linear-gradient(180deg, var(--model-cyan), var(--model-rose));
}

.model-portfolio-page .directory-header h1 {
    margin-bottom: 0.45rem;
    font-size: clamp(1.9rem, 3.8vw, 2.7rem);
    letter-spacing: -0.025em;
}

.model-portfolio-page .directory-header p {
    max-width: 60ch;
    color: rgba(226, 232, 240, 0.8);
}

.model-portfolio-page .directory-header-meta {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 8px;
}

.model-portfolio-quick-nav {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin: 0 0 1rem;
    padding: 0.7rem 0.85rem;
    border: 1px solid var(--model-border);
    border-radius: 16px;
    background: rgba(10, 18, 33, 0.54);
}

.model-portfolio-quick-nav-label {
    color: rgba(226, 232, 240, 0.62);
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-right: 2px;
}

.model-portfolio-hero-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.35fr) minmax(300px, 0.95fr);
    gap: 16px;
    margin: 0 0 1.15rem;
}

.model-portfolio-hero-main,
.model-portfolio-hero-side,
.model-portfolio-snapshot-grid {
    display: grid;
    gap: 14px;
}

.model-portfolio-hero-side {
    align-self: start;
    position: sticky;
    top: 84px;
}

.model-portfolio-hero-main .top-stats,
.model-portfolio-hero-main .model-portfolio-follow-suggestions,
.model-portfolio-hero-side .top-stats,
.model-portfolio-hero-side .model-portfolio-status-grid,
.model-portfolio-hero-side .model-portfolio-alert-rail {
    margin: 0;
}

.model-portfolio-hero-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.model-portfolio-hero-actions .btn-secondary {
    min-width: 0;
}

.model-portfolio-section-anchor {
    display: block;
    position: relative;
    top: -84px;
    visibility: hidden;
}

.model-portfolio-action-rail {
    display: grid;
    grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr) minmax(0, 1fr);
    gap: 14px;
    margin: 0 0 1rem;
}

.model-portfolio-action-card {
    position: relative;
    overflow: hidden;
    display: grid;
    gap: 10px;
    padding: 18px 20px;
    border: 1px solid var(--model-border);
    border-radius: 22px;
    background: linear-gradient(165deg, rgba(13, 22, 38, 0.9), rgba(9, 15, 28, 0.82));
    box-shadow: 0 16px 30px rgba(0, 0, 0, 0.16);
}

.model-portfolio-action-card::before {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0));
}

.model-portfolio-action-card.is-primary {
    border-color: rgba(56, 189, 248, 0.26);
    background:
        radial-gradient(circle at top right, rgba(56, 189, 248, 0.14) 0%, rgba(56, 189, 248, 0) 34%),
        linear-gradient(165deg, rgba(13, 24, 42, 0.95), rgba(9, 15, 28, 0.88));
}

.model-portfolio-action-eyebrow {
    color: rgba(184, 222, 255, 0.78);
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.model-portfolio-action-card h2 {
    margin: 0;
    font-size: 1.08rem;
    color: #f8fafc;
}

.model-portfolio-action-card p {
    margin: 0;
    color: rgba(226, 232, 240, 0.76);
    font-size: 0.9rem;
    line-height: 1.5;
}

.model-portfolio-action-card .model-portfolio-card-actions {
    margin-top: auto;
    padding-top: 4px;
}

.model-portfolio-action-card .btn-primary,
.model-portfolio-action-card .btn-secondary {
    width: fit-content;
}

.model-portfolio-follow-suggestions {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
    margin: 0 0 1rem;
}

.model-portfolio-follow-suggestion {
    padding: 14px 16px;
    border-radius: 18px;
    border: 1px solid rgba(148, 163, 184, 0.14);
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.02));
}

.model-portfolio-follow-suggestion strong {
    display: block;
    margin-bottom: 6px;
    color: #f8fafc;
    font-size: 0.95rem;
}

.model-portfolio-follow-suggestion p {
    margin: 0;
    color: rgba(226, 232, 240, 0.76);
    font-size: 0.88rem;
    line-height: 1.5;
}

.model-portfolio-follow-suggestion.tone-risk {
    border-color: rgba(248, 113, 113, 0.24);
    background: rgba(127, 29, 29, 0.12);
}

.model-portfolio-follow-suggestion.tone-watch {
    border-color: rgba(251, 191, 36, 0.24);
    background: rgba(120, 83, 12, 0.12);
}

.model-portfolio-alert-rail {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    margin: 0 0 1rem;
}

.model-portfolio-alert {
    padding: 14px 16px;
    border-radius: 18px;
    border: 1px solid rgba(148, 163, 184, 0.14);
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.02));
}

.model-portfolio-alert strong {
    display: block;
    margin-bottom: 6px;
    color: #f8fafc;
    font-size: 0.94rem;
}

.model-portfolio-alert p {
    margin: 0;
    color: rgba(226, 232, 240, 0.76);
    font-size: 0.86rem;
    line-height: 1.48;
}

.model-portfolio-alert.tone-risk {
    border-color: rgba(248, 113, 113, 0.24);
    background: rgba(127, 29, 29, 0.12);
}

.model-portfolio-alert.tone-watch {
    border-color: rgba(251, 191, 36, 0.24);
    background: rgba(120, 83, 12, 0.12);
}

.model-portfolio-allocation-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
}

.model-portfolio-activity-strip {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
    gap: 12px;
}

.model-portfolio-activity-item {
    padding: 14px 16px;
    border-radius: 16px;
    border: 1px solid rgba(148, 163, 184, 0.14);
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.045), rgba(255, 255, 255, 0.02));
    display: grid;
    gap: 8px;
}

.model-portfolio-activity-item strong {
    color: #f8fafc;
    font-size: 0.98rem;
}

.model-portfolio-activity-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.model-portfolio-filter-row {
    display: grid;
    gap: 10px;
    margin: 0 0 14px;
}

.model-portfolio-filter-group {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}

.model-portfolio-filter-label {
    color: rgba(226, 232, 240, 0.68);
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.model-portfolio-filter-pill {
    display: inline-flex;
    align-items: center;
    padding: 0.34rem 0.62rem;
    border-radius: 999px;
    border: 1px solid rgba(148, 163, 184, 0.14);
    background: rgba(255, 255, 255, 0.03);
    color: rgba(226, 232, 240, 0.82);
    text-decoration: none;
    font-size: 0.8rem;
    transition: border-color 140ms ease, background 140ms ease, color 140ms ease, transform 140ms ease;
}

.model-portfolio-filter-pill:hover {
    border-color: rgba(56, 189, 248, 0.22);
    color: #f8fdff;
    transform: translateY(-1px);
}

.model-portfolio-filter-pill.is-active {
    border-color: rgba(56, 189, 248, 0.28);
    background: rgba(56, 189, 248, 0.1);
    color: #d9f6ff;
}

.model-portfolio-timeline {
    display: grid;
    gap: 12px;
}

.model-portfolio-timeline-item {
    display: grid;
    gap: 10px;
    padding: 14px 16px;
    border-radius: 16px;
    border: 1px solid rgba(148, 163, 184, 0.14);
    background: rgba(255, 255, 255, 0.03);
}

.model-portfolio-timeline-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.model-portfolio-bar-list {
    display: grid;
    gap: 12px;
}

.model-portfolio-bar-row {
    display: grid;
    gap: 6px;
}

.model-portfolio-bar-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    color: rgba(241, 245, 249, 0.86);
    font-size: 0.88rem;
}

.model-portfolio-bar-head strong {
    color: #f8fafc;
    font-size: 0.84rem;
}

.model-portfolio-bar-track {
    height: 8px;
    border-radius: 999px;
    background: rgba(148, 163, 184, 0.14);
    overflow: hidden;
}

.model-portfolio-bar-track span {
    display: block;
    height: 100%;
    border-radius: 999px;
    background: linear-gradient(90deg, rgba(56, 189, 248, 0.88), rgba(14, 165, 233, 0.96));
}

.model-portfolio-follow-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr) minmax(0, 1fr);
    gap: 16px;
    margin-bottom: 1rem;
}

.model-portfolio-follow-grid-tight {
    grid-template-columns: minmax(0, 1.2fr) minmax(0, 0.9fr) minmax(0, 0.9fr);
    margin-bottom: 0;
}

.model-portfolio-snapshot-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    margin-bottom: 1rem;
}

.model-portfolio-status-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 0.85rem;
    margin: 0 0 1.15rem;
}

.model-portfolio-status-card {
    border: 1px solid rgba(92, 116, 147, 0.26);
    background: linear-gradient(180deg, rgba(10, 18, 33, 0.82), rgba(8, 14, 26, 0.72));
    border-radius: 16px;
    padding: 0.95rem 1rem;
    box-shadow: 0 14px 32px rgba(0, 0, 0, 0.18);
}

.model-portfolio-status-card label {
    display: block;
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #8ea7c4;
    margin-bottom: 0.45rem;
}

.model-portfolio-status-card strong {
    display: block;
    font-size: 1.2rem;
    line-height: 1.2;
    color: #f4f8fd;
    margin-bottom: 0.28rem;
}

.model-portfolio-panel {
    display: flex;
    flex-direction: column;
    gap: 14px;
    padding: 18px 20px;
    border: 1px solid rgba(116, 142, 178, 0.18);
    border-radius: 20px;
    background: linear-gradient(165deg, rgba(13, 22, 38, 0.9), rgba(9, 15, 28, 0.82));
    box-shadow: 0 16px 30px rgba(0, 0, 0, 0.16);
    position: relative;
    overflow: hidden;
}

.model-portfolio-panel::after {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.035), rgba(255, 255, 255, 0));
}

.model-portfolio-panel-accent {
    border-color: rgba(56, 189, 248, 0.28);
    background:
        radial-gradient(circle at top right, rgba(56, 189, 248, 0.12) 0%, rgba(56, 189, 248, 0) 36%),
        linear-gradient(165deg, rgba(13, 24, 42, 0.94), rgba(9, 15, 28, 0.88));
}

.model-portfolio-panel-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}

.model-portfolio-panel-head h2 {
    margin: 0;
    font-size: 1.02rem;
}

.model-portfolio-panel-head p,
.model-portfolio-panel-note {
    margin: 0;
    color: rgba(226, 232, 240, 0.7);
    font-size: 0.88rem;
    line-height: 1.5;
}

.model-portfolio-panel-note {
    display: grid;
    gap: 6px;
}

.model-portfolio-kpi-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
}

.model-portfolio-kpi {
    padding: 10px 12px;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(148, 163, 184, 0.12);
}

.model-portfolio-kpi label {
    display: block;
    margin-bottom: 4px;
    color: rgba(226, 232, 240, 0.58);
    font-size: 0.72rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.model-portfolio-kpi strong {
    color: #f8fafc;
    font-size: 1.08rem;
}

.model-portfolio-chip-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.model-portfolio-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 0.34rem 0.62rem;
    border-radius: 999px;
    border: 1px solid rgba(148, 163, 184, 0.16);
    background: rgba(255, 255, 255, 0.04);
    color: rgba(241, 245, 249, 0.88);
    font-size: 0.77rem;
    font-weight: 700;
}

.model-portfolio-chip-neutral {
    border-color: rgba(56, 189, 248, 0.25);
    color: #d6f4ff;
}

.model-portfolio-chip-risk {
    border-color: rgba(248, 113, 113, 0.35);
    background: rgba(127, 29, 29, 0.18);
    color: #ffe5e5;
}

.model-portfolio-chip-watch {
    border-color: rgba(251, 191, 36, 0.32);
    background: rgba(120, 83, 12, 0.18);
    color: #fff4d6;
}

.model-portfolio-chip-soft {
    color: rgba(226, 232, 240, 0.82);
}

.model-portfolio-signal-list {
    display: grid;
    gap: 10px;
}

.model-portfolio-signal-item {
    padding: 14px;
    border-radius: 16px;
    border: 1px solid rgba(148, 163, 184, 0.14);
    background: rgba(255, 255, 255, 0.03);
    display: grid;
    gap: 10px;
}

.model-portfolio-signal-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
}

.model-portfolio-signal-top strong {
    color: #f8fafc;
    font-size: 1rem;
}

.model-portfolio-signal-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 12px;
    color: rgba(226, 232, 240, 0.72);
    font-size: 0.82rem;
}

.model-portfolio-signal-note {
    color: rgba(241, 245, 249, 0.82);
    font-size: 0.88rem;
    line-height: 1.45;
}

.model-portfolio-table-flags {
    margin-top: 8px;
}

.model-portfolio-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 18px;
}

.model-portfolio-card {
    background: rgba(15, 23, 42, 0.78);
    border: 1px solid rgba(148, 163, 184, 0.18);
    border-radius: 20px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    position: relative;
    overflow: hidden;
    transition: transform 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
}

.model-portfolio-card::before {
    content: "";
    position: absolute;
    inset: 0 auto auto 0;
    width: 100%;
    height: 4px;
    background: linear-gradient(90deg, var(--model-cyan), var(--model-rose));
    opacity: 0.92;
}

.model-portfolio-card:hover {
    transform: translateY(-3px);
    border-color: rgba(56, 189, 248, 0.26);
    box-shadow: 0 18px 34px rgba(0, 0, 0, 0.22);
}

.model-portfolio-card-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}

.model-portfolio-card-head h2 {
    margin: 0;
    font-size: 1.15rem;
}

.model-portfolio-card-head a {
    color: #f8fafc;
    text-decoration: none;
}

.model-portfolio-card-head a:hover {
    color: #d6f4ff;
}

.model-portfolio-card-text,
.model-portfolio-card-meta,
.model-portfolio-muted {
    color: rgba(226, 232, 240, 0.7);
    font-size: 0.92rem;
    line-height: 1.45;
}

.model-portfolio-card-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.model-portfolio-card-stats {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
}

.model-portfolio-card-stats > div {
    padding: 10px 12px;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.035);
    border: 1px solid rgba(148, 163, 184, 0.1);
}

.model-portfolio-card-stats label {
    display: block;
    margin-bottom: 4px;
    color: rgba(226, 232, 240, 0.58);
    font-size: 0.76rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.model-portfolio-card-stats strong {
    color: #f8fafc;
    font-size: 1rem;
}

.model-portfolio-card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-top: auto;
}

.model-portfolio-card-actions {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
}

.model-portfolio-definition-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 12px 18px;
    color: rgba(226, 232, 240, 0.82);
    font-size: 0.92rem;
    line-height: 1.45;
}

.model-portfolio-definition-grid strong {
    color: rgba(248, 250, 252, 0.92);
}

.model-portfolio-performance-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 12px;
}

.model-portfolio-performance-item {
    display: block;
    padding: 14px 16px;
    border-radius: 16px;
    border: 1px solid rgba(148, 163, 184, 0.16);
    background: rgba(15, 23, 42, 0.52);
    color: inherit;
    text-decoration: none;
    transition: border-color 140ms ease, transform 140ms ease, background 140ms ease;
}

.model-portfolio-performance-item:hover {
    transform: translateY(-2px);
    border-color: rgba(56, 189, 248, 0.24);
    background: rgba(15, 23, 42, 0.66);
}

.model-portfolio-performance-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 8px;
}

.model-portfolio-performance-top strong {
    color: #f8fafc;
}

.model-portfolio-performance-meta,
.model-portfolio-note-cell {
    color: rgba(226, 232, 240, 0.72);
    font-size: 0.88rem;
    line-height: 1.4;
}

.model-portfolio-inline-meta {
    margin-top: 4px;
    color: rgba(148, 163, 184, 0.88);
    font-size: 0.8rem;
    line-height: 1.35;
}

.model-portfolio-chart-shell {
    display: grid;
    gap: 10px;
}

.model-portfolio-chart {
    display: block;
    width: 100%;
    height: auto;
    color: #38bdf8;
    overflow: visible;
}

.model-portfolio-chart-axis {
    stroke: rgba(148, 163, 184, 0.22);
    stroke-width: 1;
}

.model-portfolio-chart-benchmark {
    stroke: rgba(244, 114, 182, 0.95);
}

.model-portfolio-chart-benchmark-dot {
    fill: rgba(244, 114, 182, 0.95);
}

.model-portfolio-chart-dot {
    fill: #38bdf8;
    stroke: rgba(8, 14, 26, 0.95);
    stroke-width: 1.2;
}

.model-portfolio-chart-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    color: rgba(226, 232, 240, 0.72);
    font-size: 0.88rem;
}

.model-portfolio-disclosure {
    margin: 0 0 1rem;
    border: 1px solid rgba(116, 142, 178, 0.16);
    border-radius: 18px;
    background: rgba(10, 18, 33, 0.72);
    overflow: hidden;
}

.model-portfolio-disclosure summary {
    list-style: none;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    padding: 16px 18px;
    cursor: pointer;
}

.model-portfolio-disclosure summary::-webkit-details-marker {
    display: none;
}

.model-portfolio-disclosure summary::after {
    content: '+';
    color: rgba(226, 232, 240, 0.72);
    font-size: 1.1rem;
    line-height: 1;
}

.model-portfolio-disclosure[open] summary::after {
    content: '-';
}

.model-portfolio-disclosure summary span:first-child {
    color: #f8fafc;
    font-weight: 700;
}

.model-portfolio-disclosure-body {
    padding: 0 18px 18px;
}

.model-portfolio-page .portfolio-holdings-shell {
    position: relative;
    border: 1px solid rgba(116, 142, 178, 0.16);
    border-radius: 22px;
    background: linear-gradient(180deg, rgba(11, 18, 31, 0.86), rgba(9, 14, 25, 0.78));
    box-shadow: 0 16px 28px rgba(0, 0, 0, 0.15);
}

.model-portfolio-page .portfolio-holdings-shell::before {
    content: "";
    position: absolute;
    inset: 0 auto 0 0;
    width: 4px;
    border-radius: 22px 0 0 22px;
    background: linear-gradient(180deg, rgba(56, 189, 248, 0.74), rgba(56, 189, 248, 0));
}

.model-portfolio-page .portfolio-holdings-header {
    position: relative;
    padding-left: 2px;
}

@media (max-width: 900px) {
    .model-portfolio-page .directory-header {
        grid-template-columns: 1fr;
        padding: 18px;
    }

    .model-portfolio-page .directory-header-meta {
        justify-content: flex-start;
    }

    .model-portfolio-follow-suggestions {
        grid-template-columns: 1fr;
    }

    .model-portfolio-alert-rail,
    .model-portfolio-allocation-grid {
        grid-template-columns: 1fr;
    }

    .model-portfolio-follow-grid {
        grid-template-columns: 1fr;
    }

    .model-portfolio-follow-grid-tight {
        grid-template-columns: 1fr;
    }

    .model-portfolio-action-rail {
        grid-template-columns: 1fr;
    }

    .model-portfolio-hero-grid,
    .model-portfolio-snapshot-grid {
        grid-template-columns: 1fr;
    }

    .model-portfolio-hero-side {
        position: static;
    }

    .model-portfolio-status-grid {
        grid-template-columns: 1fr;
    }

    .model-portfolio-kpi-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .model-portfolio-card-stats {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .model-portfolio-card-footer {
        flex-direction: column;
        align-items: flex-start;
    }
}

/* === Portfolio page content structure === */

/* Stats block — wraps toggle + stat cards as one unit */
.portfolio-page .portfolio-stats-block {
    margin-bottom: 0.82rem;
}
.portfolio-page .portfolio-stats-block .top-stats {
    margin-bottom: 0;
}

/* Toggle right-aligned above the stat cards */
.portfolio-page .portfolio-stats-controls {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 0.52rem;
}
.portfolio-page .portfolio-stats-controls .totals-mode-toggle {
    margin: 0;
}

/* On mobile the toggle fills the full width */
@media (max-width: 900px) {
    .portfolio-page .portfolio-stats-controls {
        justify-content: stretch;
    }
    .portfolio-page .portfolio-stats-controls .totals-mode-toggle {
        width: 100%;
        justify-content: space-between;
    }
}

/* Section labels — visible on desktop as subtle uppercase dividers */
.portfolio-page .portfolio-mobile-summary {
    display: block;
    list-style: none;
    font-size: 0.62rem;
    font-weight: 700;
    color: var(--text-muted);
    letter-spacing: 0.09em;
    text-transform: uppercase;
    padding: 0.55rem 0 0.38rem;
    border-top: 1px solid rgba(51, 89, 127, 0.2);
    margin-bottom: 0.42rem;
    pointer-events: none;
    cursor: default;
}
.portfolio-page .portfolio-mobile-summary::-webkit-details-marker {
    display: none;
}

/* Mobile — restore full interactive toggle style */
@media (max-width: 900px) {
    .portfolio-page .portfolio-mobile-summary {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 0.5rem;
        padding: 0.78rem 0.82rem;
        font-size: 0.82rem;
        font-weight: 800;
        letter-spacing: -0.01em;
        text-transform: none;
        border-top: none;
        margin-bottom: 0;
        color: var(--text-primary);
        pointer-events: auto;
        cursor: pointer;
    }
}

/* === Portfolio page design refresh === */

/* Toolbar card — cyan top accent */
.portfolio-page .portfolio-toolbar {
    border-top: 2px solid rgba(57, 194, 255, 0.22) !important;
}

/* Portfolio title — more prominent */
.portfolio-page .portfolio-title {
    font-size: 1.18rem;
    letter-spacing: -0.03em;
}


/* Primary stat cards — cyan top accent */
.portfolio-page .top-stats-primary .eval-panel,
.portfolio-page .top-stats-primary .value-panel,
.public-portfolio-page .top-stats-primary .eval-panel,
.public-portfolio-page .top-stats-primary .value-panel {
    border-top: 2px solid rgba(57, 194, 255, 0.28) !important;
}

/* Secondary stat cards — quieter top accent */
.portfolio-page .top-stats-secondary .value-panel,
.public-portfolio-page .top-stats-secondary .value-panel {
    border-top: 2px solid rgba(57, 194, 255, 0.13) !important;
}

/* Holdings container — cyan top accent */
.portfolio-page .holdings-container {
    border-top: 2px solid rgba(57, 194, 255, 0.22) !important;
}

/* Holdings table row hover — brand cyan tint */
.portfolio-page .holdings-table tr.holding-row:hover td {
    background: rgba(57, 194, 255, 0.04);
}

/* Create portfolio btn — cyan on hover */
@media (hover: hover) {
    .portfolio-page .create-p-btn:hover {
        border-color: rgba(57, 194, 255, 0.4);
        background: rgba(57, 194, 255, 0.05);
        color: var(--text-secondary);
    }
}

/* Totals mode toggle — brand cyan active button */
.totals-mode-btn.is-active {
    background: rgba(57, 194, 255, 0.16);
    box-shadow: inset 0 0 0 1px rgba(57, 194, 255, 0.25);
    color: #e8f8ff;
}

/* Priority banner — colored left accent per tone */
.portfolio-priority-banner {
    border-left: 3px solid rgba(57, 194, 255, 0.3);
}
.portfolio-priority-banner.tone-good { border-left-color: rgba(16, 185, 129, 0.55); }
.portfolio-priority-banner.tone-warn { border-left-color: rgba(245, 158, 11, 0.55); }
.portfolio-priority-banner.tone-risk { border-left-color: rgba(239, 68, 68, 0.55); }

/* === Profile page design refresh === */

/* Gradient text on profile page h1 */
.profile-page .directory-header h1 {
    background: linear-gradient(125deg, var(--text-primary) 25%, #8eccf5 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    color: transparent;
}

/* Cyan top accent on section cards */
.profile-page .profile-section {
    border-top: 2px solid rgba(57, 194, 255, 0.28) !important;
}

/* Delete section retains red top accent */
.profile-page .delete-section {
    border-top: 2px solid rgba(239, 68, 68, 0.45) !important;
}

/* Status chip (first) gets cyan tint */
.profile-summary-chip:first-child {
    border-color: rgba(57, 194, 255, 0.38);
    background: rgba(57, 194, 255, 0.07);
    color: #a8dff7;
}

/* btn-save hover */
@media (hover: hover) {
    .profile-page .btn-save:hover {
        background: linear-gradient(180deg, #f4f9ff 0%, #e4eef8 100%) !important;
        box-shadow: 0 2px 14px rgba(57, 194, 255, 0.14) !important;
    }
}

/* === Portfolio repetition fixes === */

/* estimate-note now lives directly in estimate-section (no .estimate-header wrapper) */
.portfolio-page .estimate-note {
    margin-bottom: 0.52rem;
}

/* Optimizer section: grid starts right after the section label — add small top breathing room */
.portfolio-page .optimizer-section > .optimizer-grid:first-child {
    margin-top: 0.1rem;
}

/* === Dividends tab === */

/* Overview strip — compact summary + link in the portfolio overview */
.portfolio-page .portfolio-dividend-overview-strip {
    margin: 0.9rem 0 0.6rem;
    padding: 0.72rem 0.9rem;
    background: rgba(8, 18, 38, 0.44);
    border: 1px solid rgba(51, 89, 127, 0.22);
    border-top: 2px solid rgba(57, 194, 255, 0.18);
    border-radius: 11px;
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.portfolio-page .portfolio-dividend-overview-strip .dividend-summary-grid {
    flex: 1 1 0;
    min-width: 0;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.6rem;
}

.portfolio-page .portfolio-dividend-overview-strip .dividend-summary-card {
    display: flex;
    flex-direction: column;
    gap: 0.18rem;
}

.portfolio-page .portfolio-dividend-overview-strip .dividend-summary-card .label {
    font-size: 0.63rem;
    color: var(--text-muted);
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.portfolio-page .portfolio-dividend-overview-strip .dividend-summary-card .value {
    font-size: 0.94rem;
    font-weight: 700;
    color: var(--text-primary);
}

.portfolio-page .dividend-overview-link {
    font-size: 0.72rem;
    font-weight: 700;
    color: rgba(57, 194, 255, 0.85);
    text-decoration: none;
    white-space: nowrap;
    padding: 0.3rem 0.6rem;
    border: 1px solid rgba(57, 194, 255, 0.22);
    border-radius: 6px;
    transition: background 0.15s, color 0.15s;
}

@media (hover: hover) {
    .portfolio-page .dividend-overview-link:hover {
        background: rgba(57, 194, 255, 0.08);
        color: #d6f2ff;
    }
}

@media (max-width: 700px) {
    .portfolio-page .portfolio-dividend-overview-strip {
        flex-direction: column;
        align-items: stretch;
        gap: 0.72rem;
    }
    .portfolio-page .portfolio-dividend-overview-strip .dividend-summary-grid {
        grid-template-columns: 1fr;
    }
    .portfolio-page .dividend-overview-link {
        text-align: center;
    }
}

/* Dividends page */
.portfolio-dividends-page .top-stats {
    margin: 0.5rem 0 1rem;
}

.portfolio-dividends-page .top-stats .value-panel {
    border-top: 2px solid rgba(57, 194, 255, 0.28) !important;
}

.dividends-section-block {
    margin: 0 0 1.4rem;
    padding: 0.9rem 1rem;
    background: var(--bg-card);
    border: 1px solid rgba(51, 89, 127, 0.22);
    border-radius: 12px;
}

.dividends-section-heading {
    font-size: 0.68rem;
    font-weight: 800;
    letter-spacing: 0.09em;
    text-transform: uppercase;
    color: var(--text-muted);
    margin: 0 0 0.82rem;
}

.dividends-empty-note {
    font-size: 0.82rem;
    color: var(--text-muted);
    margin: 0;
}

.dividends-holdings-table .holding-subline {
    font-size: 0.72rem;
    color: var(--text-muted);
    margin-top: 0.1rem;
}

/* Priority banner: give it a cleaner look as a "featured action" callout */
.portfolio-page .portfolio-priority-banner {
    background: rgba(8, 18, 38, 0.55);
}
.portfolio-page .portfolio-priority-banner.tone-good {
    background: rgba(4, 30, 20, 0.45);
}
.portfolio-page .portfolio-priority-banner.tone-warn {
    background: rgba(30, 20, 4, 0.45);
}
.portfolio-page .portfolio-priority-banner.tone-risk {
    background: rgba(30, 6, 6, 0.42);
}

/* === Portfolio overview visual improvements === */

/* Health score eval-panel — color-coded by portfolio status */
.portfolio-page .eval-panel.tone-good {
    border-top-color: rgba(16, 185, 129, 0.55) !important;
}
.portfolio-page .eval-panel.tone-good .eval-score {
    color: #34d399;
}
.portfolio-page .eval-panel.tone-warn {
    border-top-color: rgba(245, 158, 11, 0.55) !important;
}
.portfolio-page .eval-panel.tone-warn .eval-score {
    color: #fbbf24;
}
.portfolio-page .eval-panel.tone-risk {
    border-top-color: rgba(239, 68, 68, 0.55) !important;
}
.portfolio-page .eval-panel.tone-risk .eval-score {
    color: #f87171;
}

/* Secondary stats — visually lighter than primary to create hierarchy */
.portfolio-page .top-stats-secondary .value-panel {
    padding: 0.82rem 1rem !important;
}
.portfolio-page .top-stats-secondary .value-amount {
    font-size: 1.1rem !important;
}
.portfolio-page .top-stats-secondary .eval-status {
    font-size: 0.63rem;
    opacity: 0.82;
}

/* Data quality warning banner — visually distinct from the action priority banner */
.portfolio-page .portfolio-priority-banner.tone-warn.data-quality-banner,
.portfolio-page .portfolio-priority-banner.tone-risk.data-quality-banner {
    border-left-width: 2px;
    border-left-style: dashed;
    opacity: 0.9;
}

/* Section ordering visual rhythm — charts now first in bottom section */
.portfolio-page .charts-grid {
    margin-top: 0;
}

/* Dividend overview strip — tighter, more inline look */
.portfolio-page .portfolio-dividend-overview-strip {
    margin-top: 0.5rem;
}

/* ======================================================
   Holdings table — Spacious card rows
   ====================================================== */

/* Stronger row hover — applies to all screen sizes */
.portfolio-page .holdings-table tr.holding-row:hover td {
    background: rgba(57, 194, 255, 0.03) !important;
}

/* Non-mobile improvements: spacing, hierarchy, legibility */
@media (min-width: 769px) {
    /* 1. More vertical breathing room on all cells */
    .portfolio-page .holdings-table td {
        padding-top: 1.1rem;
        padding-bottom: 1.1rem;
    }

    /* 2. Main cell: aligned padding + min-width so ticker/name never crushes */
    .portfolio-page .holding-main-cell {
        padding-top: 1.1rem;
        padding-bottom: 1.1rem;
        min-width: 185px;
    }

    /* 3. Ticker: a touch more presence */
    .portfolio-page .ticker-line {
        font-size: 1.0rem;
    }

    /* 4. Company subline: more air below ticker */
    .portfolio-page .holding-subline {
        margin-top: 0.3rem;
        gap: 0.3rem;
        line-height: 1.4;
    }
    .portfolio-page .holding-company-name {
        font-size: 0.73rem;
    }
    .portfolio-page .holding-sector-tag {
        font-size: 0.63rem;
    }

    /* 5. Decision chips: clear separation from the subline */
    .portfolio-page .holding-decision-line {
        margin-top: 0.66rem;
        gap: 0.4rem;
    }

    /* 6. Key value columns: more legible */
    .portfolio-page .holdings-table td.metric-value,
    .portfolio-page .holdings-table td.metric-pl {
        font-size: 0.9rem !important;
    }
}

/* Desktop-only: action stack vertical layout + support row visual merge */
@media (min-width: 901px) {
    /* 7. Action stack: stacked vertically — cleaner and narrower column */
    .portfolio-page .action-stack {
        flex-direction: column;
        align-items: stretch;
        justify-content: flex-start;
        gap: 0.28rem;
        min-width: 66px;
    }
    .portfolio-page .action-stack .badge-mini,
    .portfolio-page .action-stack .action-btn {
        display: flex;
        align-items: center;
        justify-content: center;
        width: 100%;
        text-align: center;
        min-height: 30px;
    }

    /* 8. Support row: reduce top gap so it reads as part of the holding above */
    .portfolio-page .holdings-table tr.holding-support-row > td.holding-support-cell {
        padding-top: 0 !important;
        padding-bottom: 0.95rem !important;
    }

    /* 9. Support row follows the holding-row hover tint */
    .portfolio-page .holdings-table tr.holding-row:hover + tr.holding-support-row > td {
        background: rgba(57, 194, 255, 0.03) !important;
    }

    /* ======================================================
       Holdings: 5-column layout (embed amount/avg/price as quick-facts)
       ====================================================== */

    /* Hide the 3 standalone columns — data now lives in quick-facts inside main cell */
    .portfolio-page .holdings-table th.th-metric-amount,
    .portfolio-page .holdings-table th.th-metric-avg,
    .portfolio-page .holdings-table th.th-metric-price,
    .portfolio-page .holdings-table td.metric-amount,
    .portfolio-page .holdings-table td.metric-avg,
    .portfolio-page .holdings-table td.metric-price {
        display: none !important;
    }

    /* Show quick-facts mini-cards inside the main cell on desktop */
    .portfolio-page .holding-quick-facts {
        display: grid;
        grid-template-columns: repeat(4, minmax(0, 1fr));
        gap: 0.42rem;
        margin-top: 0.64rem;
    }

    /* Redistribute column widths across the now-5-column layout */
    .portfolio-page .holdings-table td.holding-main-cell {
        width: 38%;
        min-width: 0;
    }
    .portfolio-page .holdings-table td.holding-dividend-cell {
        width: 10rem;
    }
    .portfolio-page .holdings-table td.metric-value {
        width: 10rem;
    }
    .portfolio-page .holdings-table td.metric-pl {
        width: 10.5rem;
    }
    .portfolio-page .holdings-table td.holding-actions-cell {
        width: 7rem;
    }

    /* Signal left-border accent — inset shadow avoids border-collapse interference */
    .portfolio-page .holdings-table tr.holding-row.signal-buy > td:first-child {
        box-shadow: inset 3px 0 0 rgba(16, 185, 129, 0.52);
    }
    .portfolio-page .holdings-table tr.holding-row.signal-sell > td:first-child {
        box-shadow: inset 3px 0 0 rgba(239, 68, 68, 0.52);
    }
    .portfolio-page .holdings-table tr.holding-row.signal-hold > td:first-child {
        box-shadow: inset 3px 0 0 rgba(245, 158, 11, 0.42);
    }

    /* Signal accent continues faintly on the support row */
    .portfolio-page .holdings-table tr.holding-row.signal-buy + tr.holding-support-row > td:first-child {
        box-shadow: inset 3px 0 0 rgba(16, 185, 129, 0.22);
    }
    .portfolio-page .holdings-table tr.holding-row.signal-sell + tr.holding-support-row > td:first-child {
        box-shadow: inset 3px 0 0 rgba(239, 68, 68, 0.22);
    }
    .portfolio-page .holdings-table tr.holding-row.signal-hold + tr.holding-support-row > td:first-child {
        box-shadow: inset 3px 0 0 rgba(245, 158, 11, 0.18);
    }
}

/* ==========================================================
   HOLDINGS TABLE — DEFINITIVE PROFESSIONAL LAYOUT
   Supersedes all previous holdings table rules.
   ========================================================== */

/* ---- All screens: table fills its container ---- */
.portfolio-page .holdings-table {
    table-layout: fixed !important;
    width: 100% !important;
}

/* ---- Desktop 901px+: clean 5-column layout ---- */
@media (min-width: 901px) {

    /* Vertical alignment: middle — rows look balanced not top-heavy */
    .portfolio-page .holdings-table th,
    .portfolio-page .holdings-table td {
        vertical-align: middle !important;
    }

    /* Keep support rows top-aligned (they're content blocks) */
    .portfolio-page .holdings-table tr.holding-support-row td {
        vertical-align: top !important;
    }

    /* Hide the 3 standalone numeric columns */
    .portfolio-page .holdings-table th.th-metric-amount,
    .portfolio-page .holdings-table th.th-metric-avg,
    .portfolio-page .holdings-table th.th-metric-price,
    .portfolio-page .holdings-table td.metric-amount,
    .portfolio-page .holdings-table td.metric-avg,
    .portfolio-page .holdings-table td.metric-price {
        display: none !important;
    }

    /* --------------------------------------------------
       5-column percentage widths — always sum to 100%.
       Set on both th class (drives table-layout: fixed)
       and td class (fallback for remaining browsers).
       Hidden columns (th-metric-*) contribute 0 width.
    -------------------------------------------------- */
    .portfolio-page .holdings-table th.th-main,
    .portfolio-page .holdings-table td.holding-main-cell {
        width: 42% !important;
    }
    .portfolio-page .holdings-table th.th-dividend,
    .portfolio-page .holdings-table td.holding-dividend-cell {
        width: 14% !important;
    }
    .portfolio-page .holdings-table th.th-value,
    .portfolio-page .holdings-table td.metric-value {
        width: 13% !important;
    }
    .portfolio-page .holdings-table th.th-pl,
    .portfolio-page .holdings-table td.metric-pl {
        width: 20% !important;
    }
    .portfolio-page .holdings-table th.th-actions,
    .portfolio-page .holdings-table td.holding-actions-cell {
        width: 11% !important;
    }
    /* Total: 42 + 14 + 13 + 20 + 11 = 100% */

    /* Numeric cells: never wrap */
    .portfolio-page .holdings-table td.metric-value,
    .portfolio-page .holdings-table td.metric-pl {
        white-space: nowrap !important;
    }

    /* Quick-facts: compact single-line strip (replaces the card grid) */
    .portfolio-page .holding-quick-facts {
        display: flex !important;
        align-items: center;
        flex-wrap: wrap;
        gap: 0;
        margin-top: 0.42rem;
    }
    .portfolio-page .holding-quick-fact {
        display: inline-flex;
        align-items: center;
        gap: 0.22rem;
        padding: 0 0.6rem 0 0;
        border: none;
        background: transparent;
        border-radius: 0;
    }
    .portfolio-page .holding-quick-fact + .holding-quick-fact {
        padding-left: 0.6rem;
        border-left: 1px solid rgba(51, 89, 127, 0.3);
    }
    .portfolio-page .holding-quick-fact-label {
        font-size: 0.61rem;
        font-weight: 700;
        text-transform: uppercase;
        letter-spacing: 0.05em;
        color: var(--text-muted);
        white-space: nowrap;
    }
    .portfolio-page .holding-quick-fact-value {
        font-size: 0.74rem;
        font-weight: 700;
        color: var(--text-secondary);
        white-space: nowrap;
    }
    .portfolio-page .holding-quick-fact-yield .holding-quick-fact-value {
        color: rgba(57, 194, 255, 0.88);
    }

    /* Action stack: clean vertical column */
    .portfolio-page .action-stack {
        display: flex !important;
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 0.22rem !important;
        width: 100%;
    }
    .portfolio-page .action-stack .badge-mini,
    .portfolio-page .action-stack .action-btn {
        display: flex !important;
        align-items: center;
        justify-content: center;
        width: 100% !important;
        min-height: 28px !important;
        text-align: center;
        font-size: 0.64rem !important;
        white-space: nowrap;
    }

    /* Dividend cell: left-aligned on desktop */
    .portfolio-page .holdings-table td.holding-dividend-cell {
        text-align: left !important;
    }
    .portfolio-page .holding-dividend-summary {
        align-items: flex-start !important;
    }

    /* Signal left-border accents */
    .portfolio-page .holdings-table tr.holding-row.signal-buy > td:first-child {
        box-shadow: inset 3px 0 0 rgba(16, 185, 129, 0.55) !important;
    }
    .portfolio-page .holdings-table tr.holding-row.signal-sell > td:first-child {
        box-shadow: inset 3px 0 0 rgba(239, 68, 68, 0.55) !important;
    }
    .portfolio-page .holdings-table tr.holding-row.signal-hold > td:first-child {
        box-shadow: inset 3px 0 0 rgba(245, 158, 11, 0.45) !important;
    }
    .portfolio-page .holdings-table tr.holding-row.signal-buy + tr.holding-support-row > td:first-child {
        box-shadow: inset 3px 0 0 rgba(16, 185, 129, 0.22) !important;
    }
    .portfolio-page .holdings-table tr.holding-row.signal-sell + tr.holding-support-row > td:first-child {
        box-shadow: inset 3px 0 0 rgba(239, 68, 68, 0.22) !important;
    }
    .portfolio-page .holdings-table tr.holding-row.signal-hold + tr.holding-support-row > td:first-child {
        box-shadow: inset 3px 0 0 rgba(245, 158, 11, 0.18) !important;
    }
}

/* === Per-holding tax type toggle buttons === */
.holding-tax-toggle {
    display: inline-flex;
    align-items: center;
    vertical-align: middle;
    border: 1px solid rgba(51, 89, 127, 0.28);
    border-radius: 4px;
    overflow: hidden;
    background: rgba(15, 23, 42, 0.45);
    margin-left: 0.25rem;
    flex-shrink: 0;
}
.holding-tax-toggle .htb {
    display: inline-flex;
    align-items: center;
    padding: 0 0.48rem;
    height: 18px;
    font-size: 0.59rem;
    font-weight: 700;
    line-height: 1;
    cursor: pointer;
    border: none;
    border-radius: 0;
    background: transparent;
    color: var(--text-muted, #64748b);
    transition: background 0.12s ease, color 0.12s ease;
    white-space: nowrap;
    letter-spacing: 0.03em;
    text-transform: uppercase;
}
.holding-tax-toggle .htb + .htb {
    border-left: 1px solid rgba(51, 89, 127, 0.28);
}
.holding-tax-toggle .htb:hover {
    background: rgba(59, 130, 246, 0.09);
    color: var(--text-secondary, #94a3b8);
}
.holding-tax-toggle .htb.active {
    background: rgba(16, 185, 129, 0.16);
    color: rgb(16, 185, 129);
}
.holding-tax-toggle.htb-loading {
    opacity: 0.55;
    pointer-events: none;
    animation: htb-pulse 0.9s ease-in-out infinite alternate;
}
@keyframes htb-pulse {
    from { opacity: 0.55; }
    to   { opacity: 0.28; }
}

/* ==========================================================
   PORTFOLIO PAGE — PROFESSIONAL POLISH
   ========================================================== */

/* --- Toolbar: card header on desktop --- */
@media (min-width: 769px) {
    .portfolio-page .portfolio-toolbar {
        background: rgba(8, 18, 38, 0.46) !important;
        border: 1px solid rgba(51, 89, 127, 0.22) !important;
        border-top: 2px solid rgba(57, 194, 255, 0.28) !important;
        border-radius: 14px !important;
        padding: 0.88rem 1.04rem !important;
        margin-bottom: 1.1rem !important;
    }
}

/* --- Portfolio title: subtle gradient text --- */
.portfolio-page .portfolio-title {
    background: linear-gradient(100deg, #dce8f4 20%, #7fcbee 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    color: transparent;
}

/* --- P/L value-amounts in stat panels: green/red --- */
.portfolio-page .value-panel .value-amount.buy { color: #34d399 !important; }
.portfolio-page .value-panel .value-amount.sell { color: #f87171 !important; }

/* --- Chart containers: cyan top accent to match stat cards --- */
.portfolio-page .chart-container {
    border-top: 2px solid rgba(57, 194, 255, 0.18) !important;
}

/* --- Optimizer cards: more visible base background --- */
.portfolio-page .optimizer-card {
    background: rgba(8, 16, 30, 0.52) !important;
}

/* --- Estimate cards: more visible base background --- */
.portfolio-page .estimate-card {
    background: rgba(8, 16, 30, 0.52) !important;
}

/* --- Estimate section: cyan top accent --- */
.portfolio-page .estimate-section {
    border-top: 2px solid rgba(57, 194, 255, 0.18) !important;
    background: rgba(8, 16, 30, 0.38) !important;
}

/* --- Optimizer suggestions: cyan top accent wrapper --- */
.portfolio-page .optimizer-suggestions {
    border-top: 2px solid rgba(57, 194, 255, 0.14) !important;
    background: rgba(8, 16, 30, 0.42) !important;
}

/* --- Section labels on desktop: slightly more readable --- */
.portfolio-page .portfolio-mobile-summary {
    font-size: 0.64rem;
    color: rgba(148, 163, 184, 0.72);
    padding-top: 0.62rem;
    letter-spacing: 0.11em;
}

/* --- Priority banner: sharper copy title --- */
.portfolio-page .portfolio-priority-banner .portfolio-priority-copy h3 {
    font-size: 1.0rem;
    letter-spacing: -0.02em;
}

/* --- Priority banner chips: more refined --- */
.portfolio-page .portfolio-priority-chip {
    font-size: 0.67rem;
    padding: 0.22rem 0.52rem;
}

/* --- Dividend overview strip: cyan top accent --- */
.portfolio-page .portfolio-dividend-overview-strip {
    border-top: 2px solid rgba(57, 194, 255, 0.18) !important;
}

/* --- Totals mode toggle: compact on desktop --- */
@media (min-width: 769px) {
    .portfolio-page .portfolio-stats-controls .totals-mode-toggle {
        padding: 0.22rem;
        border-radius: 8px;
    }
    .portfolio-page .portfolio-stats-controls .totals-mode-btn {
        min-height: 28px;
        padding: 0.2rem 0.64rem;
        font-size: 0.7rem;
        border-radius: 6px;
    }
    .portfolio-page .portfolio-stats-controls .totals-mode-label {
        font-size: 0.62rem;
    }
}

/* --- Stat panel eval-score: large prominent number --- */
@media (min-width: 901px) {
    .portfolio-page .eval-score {
        font-size: 2.2rem;
        font-weight: 900;
        letter-spacing: -0.03em;
    }
    .portfolio-page .top-stats-primary .value-amount {
        font-size: 1.72rem;
        letter-spacing: -0.025em;
    }
}

/* --- Optimizer section wrapper on desktop: card feel --- */
@media (min-width: 769px) {
    .portfolio-page .optimizer-section {
        padding: 0.72rem 0.82rem;
        background: rgba(8, 16, 30, 0.32);
        border: 1px solid rgba(51, 89, 127, 0.24);
        border-top: 2px solid rgba(57, 194, 255, 0.16);
        border-radius: 12px;
    }
    .portfolio-page .optimizer-section > .optimizer-grid:first-child {
        margin-top: 0.42rem;
    }
    .portfolio-page .optimizer-suggestions {
        margin-top: 0.72rem;
        border-top: 1px solid rgba(51, 89, 127, 0.22) !important;
        border-left: 0 !important;
        border-right: 0 !important;
        border-bottom: 0 !important;
        background: transparent !important;
        padding: 0.52rem 0 0 !important;
        border-radius: 0 !important;
    }
}

/* ==========================================================
   UX & INTERACTION POLISH
   ========================================================== */

/* --- Portfolio alerts: stronger, more readable --- */
.portfolio-page .portfolio-alert {
    padding: 0.78rem 1rem;
    border-left: 3px solid;
    border-radius: 10px;
    font-size: 0.86rem;
    font-weight: 500;
    display: flex;
    align-items: flex-start;
    gap: 0.55rem;
}
.portfolio-page .portfolio-alert.is-success {
    background: rgba(16, 185, 129, 0.14) !important;
    border-color: rgba(16, 185, 129, 0.65) !important;
    border-left-color: rgba(16, 185, 129, 0.75) !important;
    color: #a7f3d0 !important;
}
.portfolio-page .portfolio-alert.is-error {
    background: rgba(239, 68, 68, 0.14) !important;
    border-color: rgba(239, 68, 68, 0.55) !important;
    border-left-color: rgba(239, 68, 68, 0.75) !important;
    color: #fecaca !important;
}
.portfolio-page .portfolio-alert::before {
    font-size: 1rem;
    line-height: 1.2;
    flex-shrink: 0;
}
.portfolio-page .portfolio-alert.is-success::before { content: "✓"; color: #34d399; }
.portfolio-page .portfolio-alert.is-error::before   { content: "✕"; color: #f87171; }

/* --- Modal close button: clearer target --- */
.portfolio-page .modal-close-btn {
    background: rgba(255, 255, 255, 0.06) !important;
    border: 1px solid rgba(74, 95, 129, 0.32) !important;
    border-radius: 8px !important;
    color: var(--text-secondary) !important;
    transition: background 0.14s, color 0.14s !important;
}
@media (hover: hover) {
    .portfolio-page .modal-close-btn:hover {
        background: rgba(239, 68, 68, 0.14) !important;
        border-color: rgba(239, 68, 68, 0.4) !important;
        color: #fca5a5 !important;
    }
}

/* --- Field help text: visible and readable --- */
.portfolio-page .portfolio-settings .field-help {
    display: block !important;
    margin-top: 0.32rem;
    font-size: 0.7rem;
    color: var(--text-muted);
    line-height: 1.4;
    font-style: italic;
}

/* --- Holdings empty state --- */
.portfolio-page .holdings-empty-cell {
    text-align: center;
    padding: 2.8rem 1rem !important;
}
.portfolio-page .holdings-empty-inner {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
}
.portfolio-page .holdings-empty-icon {
    font-size: 1.8rem;
    opacity: 0.28;
}
.portfolio-page .holdings-empty-title {
    font-size: 0.88rem;
    font-weight: 700;
    color: var(--text-secondary);
    margin: 0;
}
.portfolio-page .holdings-empty-sub {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin: 0;
}

/* --- Add-stock-grid: desktop card treatment --- */
@media (min-width: 769px) {
    .portfolio-page .add-stock-grid {
        background: rgba(8, 16, 30, 0.44) !important;
        border: 1px solid rgba(51, 89, 127, 0.24) !important;
        border-top: 2px solid rgba(57, 194, 255, 0.16) !important;
        border-radius: 12px !important;
    }
    .portfolio-page .add-stock-grid .form-group label {
        color: rgba(148, 163, 184, 0.82);
        font-size: 0.6rem;
        letter-spacing: 0.07em;
        text-transform: uppercase;
        font-weight: 700;
    }
}

/* --- Import section: collapse toggle indicator on desktop --- */
.portfolio-page .portfolio-utility-block.mobile-collapse-details.portfolio-mobile-details {
    border-top: 1px solid rgba(51, 89, 127, 0.18);
    margin-top: 0.72rem;
    padding-top: 0.6rem;
}

/* --- Holdings header: polish the count badge --- */
.portfolio-page .holdings-header-chip {
    background: rgba(57, 194, 255, 0.08) !important;
    border-color: rgba(57, 194, 255, 0.2) !important;
    color: rgba(186, 230, 253, 0.9) !important;
}

/* --- Action buttons: disabled state more obvious --- */
.portfolio-page .action-stack button:disabled,
.portfolio-page .action-stack a[disabled] {
    opacity: 0.28 !important;
    cursor: not-allowed !important;
    pointer-events: none !important;
}

/* --- Move modal: "no targets" message --- */
.portfolio-page .move-modal-no-targets {
    font-size: 0.78rem;
    color: var(--text-muted);
    text-align: center;
    padding: 0.52rem 0.2rem;
    line-height: 1.5;
}
.portfolio-page .move-modal-no-targets a {
    color: rgba(57, 194, 255, 0.85);
    text-decoration: none;
    font-weight: 600;
}

/* --- Section nav: aria-current visual reinforcement --- */
.portfolio-page .portfolio-section-link[aria-current="page"] {
    color: #d6f2ff;
    border-bottom-color: rgba(57, 194, 255, 0.75);
    font-weight: 700;
}

/* --- Export section: card treatment + hide duplicate title on desktop --- */
@media (min-width: 769px) {
    .portfolio-page .export-section {
        background: rgba(8, 16, 30, 0.38) !important;
        border: 1px solid rgba(51, 89, 127, 0.24) !important;
        border-top: 2px solid rgba(57, 194, 255, 0.14) !important;
    }
    .portfolio-page .portfolio-utility-block .export-title {
        display: none;
    }
}

/* --- Holdings table header: subtle sticky look on desktop --- */
@media (min-width: 901px) {
    .portfolio-page .holdings-table thead th {
        background: rgba(8, 16, 30, 0.72) !important;
        border-bottom: 1px solid rgba(57, 194, 255, 0.14) !important;
        font-size: 0.65rem;
        letter-spacing: 0.1em;
        color: rgba(148, 163, 184, 0.7);
    }
}

/* --- Holdings container header: cyan accent border --- */
.portfolio-page .holdings-container {
    border-top: 2px solid rgba(57, 194, 255, 0.22) !important;
}
.portfolio-page .holdings-header {
    background: rgba(8, 16, 30, 0.42);
    border-bottom-color: rgba(57, 194, 255, 0.1) !important;
}
.portfolio-page .holdings-header-copy h3 {
    font-size: 0.9rem;
    letter-spacing: -0.01em;
}

/* --- Holding row: slightly more breathing room between rows on desktop --- */
@media (min-width: 901px) {
    .portfolio-page .holdings-table tr.holding-row + tr.holding-row > td {
        border-top: 1px solid rgba(51, 89, 127, 0.1);
    }
}

/* --- Stat panel: subtle inner glow on eval-score number --- */
.portfolio-page .eval-panel.tone-good { background: linear-gradient(180deg, rgba(6, 30, 22, 0.92), rgba(8, 18, 29, 0.97)) !important; }
.portfolio-page .eval-panel.tone-warn { background: linear-gradient(180deg, rgba(26, 20, 6, 0.92), rgba(8, 18, 29, 0.97)) !important; }
.portfolio-page .eval-panel.tone-risk { background: linear-gradient(180deg, rgba(28, 8, 8, 0.9), rgba(8, 18, 29, 0.97)) !important; }

/* ============================================
   EVALUATOR PAGE — DESIGN & LAYOUT POLISH
   ============================================ */

/* --- Section card treatment on desktop --- */
@media (min-width: 769px) {
    .portfolio-evaluator-page .evaluator-steps-section,
    .portfolio-evaluator-page .evaluator-tax-section,
    .portfolio-evaluator-page .evaluator-delta-section,
    .portfolio-evaluator-page .evaluator-holdings-section,
    .portfolio-evaluator-page .evaluator-history-section,
    .portfolio-evaluator-run-page .evaluator-steps-section,
    .portfolio-evaluator-run-page .evaluator-holdings-section,
    .portfolio-evaluator-run-page .evaluator-history-section,
    .portfolio-evaluator-run-page .evaluator-delta-section {
        background: rgba(8, 16, 30, 0.38);
        border: 1px solid rgba(51, 89, 127, 0.22);
        border-top: 2px solid rgba(57, 194, 255, 0.18);
        border-radius: 14px;
        padding: 1.1rem 1.2rem;
    }
    .portfolio-evaluator-page .evaluator-detail-grid,
    .portfolio-evaluator-run-page .evaluator-detail-grid {
        background: rgba(8, 16, 30, 0.38);
        border: 1px solid rgba(51, 89, 127, 0.22);
        border-top: 2px solid rgba(57, 194, 255, 0.13);
        border-radius: 14px;
        padding: 1.1rem 1.2rem;
    }
}

/* --- evaluator-step-card: tone backgrounds + colored top border --- */
.evaluator-step-card.tone-good {
    background: linear-gradient(160deg, rgba(16, 39, 31, 0.85), rgba(11, 21, 34, 0.96));
    border-top: 2px solid rgba(58, 177, 110, 0.5) !important;
}
.evaluator-step-card.tone-warn {
    background: linear-gradient(160deg, rgba(43, 33, 15, 0.85), rgba(11, 21, 34, 0.96));
    border-top: 2px solid rgba(208, 158, 53, 0.5) !important;
}
.evaluator-step-card.tone-risk {
    background: linear-gradient(160deg, rgba(43, 20, 20, 0.85), rgba(11, 21, 34, 0.96));
    border-top: 2px solid rgba(199, 89, 89, 0.5) !important;
}

/* --- audit-holding-card: tone backgrounds --- */
.audit-holding-card.tone-good { background: linear-gradient(160deg, rgba(16, 39, 31, 0.82), rgba(11, 21, 34, 0.96)); }
.audit-holding-card.tone-warn { background: linear-gradient(160deg, rgba(43, 33, 15, 0.82), rgba(11, 21, 34, 0.96)); }
.audit-holding-card.tone-risk { background: linear-gradient(160deg, rgba(43, 20, 20, 0.82), rgba(11, 21, 34, 0.96)); }

/* --- evaluator-step-value: larger + bolder on evaluator pages --- */
.portfolio-evaluator-page .evaluator-step-value,
.portfolio-evaluator-run-page .evaluator-step-value {
    font-size: 1.22rem;
    font-weight: 800;
    letter-spacing: -0.02em;
}

/* --- Split-header h3: left border accent on evaluator pages --- */
.portfolio-evaluator-page .split-header h3,
.portfolio-evaluator-run-page .split-header h3 {
    padding-left: 0.6rem;
    border-left: 3px solid rgba(57, 194, 255, 0.5);
    line-height: 1.3;
}

/* --- Health score card: larger primary number --- */
.portfolio-evaluator-page .top-stats-primary .summary-card:first-child .value,
.portfolio-evaluator-run-page .top-stats-primary .summary-card:first-child .value {
    font-size: 1.9rem;
    font-weight: 900;
    letter-spacing: -0.03em;
}

/* --- evaluator-steps-grid: 3 cols on medium desktop (769–1100px) --- */
@media (min-width: 769px) and (max-width: 1100px) {
    .portfolio-evaluator-page .evaluator-steps-section .evaluator-steps-grid,
    .portfolio-evaluator-run-page .evaluator-steps-section .evaluator-steps-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

/* --- Tax steps grid: cap at 3 columns --- */
.portfolio-evaluator-page .evaluator-tax-section .evaluator-steps-grid,
.portfolio-evaluator-run-page .evaluator-tax-section .evaluator-steps-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}
@media (max-width: 900px) {
    .portfolio-evaluator-page .evaluator-tax-section .evaluator-steps-grid,
    .portfolio-evaluator-run-page .evaluator-tax-section .evaluator-steps-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

/* --- History table: polished header --- */
.portfolio-evaluator-page .evaluator-history-table th,
.portfolio-evaluator-run-page .evaluator-history-table th {
    font-size: 0.64rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: rgba(148, 163, 184, 0.7);
    background: rgba(8, 16, 30, 0.55);
}

/* --- History filter form: inline layout --- */
.portfolio-evaluator-page .history-filter-form,
.portfolio-evaluator-run-page .history-filter-form {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    flex-wrap: wrap;
    margin-top: 0.6rem;
}
.portfolio-evaluator-page .history-filter-form label,
.portfolio-evaluator-run-page .history-filter-form label {
    font-size: 0.74rem;
    color: var(--text-muted);
    white-space: nowrap;
}

/* --- Delta section: spacing between chip rows --- */
.portfolio-evaluator-page .evaluator-delta-section .detail-chip-row + .detail-chip-row,
.portfolio-evaluator-run-page .evaluator-delta-section .detail-chip-row + .detail-chip-row {
    margin-top: 0.52rem;
}

/* --- Evaluator accounting-summary-grid: add top-accent --- */
@media (min-width: 769px) {
    .portfolio-evaluator-page .accounting-summary-grid,
    .portfolio-evaluator-run-page .accounting-summary-grid {
        padding-top: 0.1rem;
    }
}

/* --- detail-card heading on evaluator page --- */
.portfolio-evaluator-page .evaluator-detail-grid .detail-card h3,
.portfolio-evaluator-run-page .evaluator-detail-grid .detail-card h3 {
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: rgba(148, 163, 184, 0.75);
    margin-bottom: 0.55rem;
    font-weight: 700;
}

/* ============================================
   ACCOUNTING PAGE — DESIGN POLISH
   ============================================ */

/* --- allocation-card: tone gradient backgrounds --- */
.accounting-allocation-card.tone-good {
    background: linear-gradient(160deg, rgba(14, 34, 26, 0.82), rgba(10, 18, 30, 0.96));
}
.accounting-allocation-card.tone-warn {
    background: linear-gradient(160deg, rgba(38, 28, 10, 0.82), rgba(10, 18, 30, 0.96));
}
.accounting-allocation-card.tone-risk {
    background: linear-gradient(160deg, rgba(38, 16, 16, 0.82), rgba(10, 18, 30, 0.96));
}

/* --- Accounting split-header: left accent --- */
.portfolio-accounting-page .split-header h3 {
    padding-left: 0.6rem;
    border-left: 3px solid rgba(57, 194, 255, 0.5);
    line-height: 1.3;
}

/* --- History section: card treatment on desktop --- */
@media (min-width: 769px) {
    .portfolio-accounting-page .accounting-history-section {
        background: rgba(8, 16, 30, 0.38);
        border: 1px solid rgba(51, 89, 127, 0.22);
        border-top: 2px solid rgba(57, 194, 255, 0.18);
        border-radius: 14px;
        padding: 1.1rem 1.2rem;
    }
    .portfolio-accounting-page .accounting-controls {
        background: rgba(8, 16, 30, 0.3);
        border: 1px solid rgba(51, 89, 127, 0.18);
        border-radius: 10px;
        padding: 0.88rem 1rem;
    }
}

/* --- Filter form: 2 cols at 900px --- */
@media (max-width: 900px) and (min-width: 641px) {
    .portfolio-accounting-page .accounting-filter-form {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

/* --- Entry panel summary: cyan accent --- */
.accounting-entry-panel > summary {
    color: rgba(57, 194, 255, 0.82);
    font-weight: 600;
    font-size: 0.88rem;
}
.accounting-entry-panel > summary:hover {
    color: rgba(57, 194, 255, 1);
}

/* --- History table header polish --- */
.portfolio-accounting-page .accounting-history-table th {
    font-size: 0.64rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: rgba(148, 163, 184, 0.7);
    background: rgba(8, 16, 30, 0.55);
}

/* --- accounting-source-chip: distinct per type --- */
.accounting-source-chip {
    display: inline-flex;
    align-items: center;
    height: 1.45rem;
    padding: 0 0.55rem;
    border-radius: 999px;
    font-size: 0.67rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}
.accounting-source-chip.source-ledger { background: rgba(22, 52, 100, 0.7); color: #93c5fd; border: 1px solid rgba(147,197,253,0.2); }
.accounting-source-chip.source-trade  { background: rgba(14, 50, 36, 0.7); color: #86efac; border: 1px solid rgba(134,239,172,0.2); }
.accounting-source-chip.source-dividend { background: rgba(50, 26, 80, 0.7); color: #c4b5fd; border: 1px solid rgba(196,181,253,0.2); }

/* --- Secondary grid detail card summary polish --- */
.portfolio-accounting-page .accounting-detail-card > summary {
    font-size: 0.8rem;
    font-weight: 700;
    color: rgba(168, 196, 224, 0.85);
    letter-spacing: 0.03em;
}
.portfolio-accounting-page .accounting-detail-card > summary:hover {
    color: #d6ecff;
}

/* --- Secondary grid cards: subtle background on desktop --- */
@media (min-width: 769px) {
    .portfolio-accounting-page .accounting-secondary-grid .accounting-detail-card {
        background: rgba(8, 16, 30, 0.32);
        border-color: rgba(51, 89, 127, 0.28);
    }
}

/* ============================================
   TAX PAGE — DESIGN POLISH
   ============================================ */

/* --- Tax split-header: left accent --- */
.portfolio-tax-page .split-header h3 {
    padding-left: 0.6rem;
    border-left: 3px solid rgba(57, 194, 255, 0.5);
    line-height: 1.3;
}

/* --- Tax page history/holdings sections: card treatment on desktop --- */
@media (min-width: 769px) {
    .portfolio-tax-page .evaluator-history-section,
    .portfolio-tax-page .evaluator-holdings-section,
    .portfolio-tax-page .evaluator-tax-section {
        background: rgba(8, 16, 30, 0.38);
        border: 1px solid rgba(51, 89, 127, 0.22);
        border-top: 2px solid rgba(57, 194, 255, 0.18);
        border-radius: 14px;
        padding: 1.1rem 1.2rem;
    }
}

/* --- Tax detail-chip-link: make clickable chips visually distinct --- */
.portfolio-tax-page .detail-chip-row a.detail-chip,
.portfolio-accounting-page .detail-chip-row a.detail-chip {
    border-color: rgba(57, 194, 255, 0.3);
    color: rgba(57, 194, 255, 0.88);
    cursor: pointer;
}
.portfolio-tax-page .detail-chip-row a.detail-chip:hover,
.portfolio-accounting-page .detail-chip-row a.detail-chip:hover {
    background: rgba(57, 194, 255, 0.1);
    border-color: rgba(57, 194, 255, 0.55);
    color: #d6f0ff;
    text-decoration: none;
}

/* --- Tax summary cards: spacing between chip rows --- */
.portfolio-tax-page .summary-card .detail-chip-row + .detail-chip-row {
    margin-top: 0.42rem;
}

/* --- Tax audit step/holding cards: tone backgrounds --- */
.portfolio-tax-page .evaluator-step-card.tone-good,
.portfolio-tax-page .audit-holding-card.tone-good { background: linear-gradient(160deg, rgba(16, 39, 31, 0.82), rgba(11, 21, 34, 0.96)); }
.portfolio-tax-page .evaluator-step-card.tone-warn,
.portfolio-tax-page .audit-holding-card.tone-warn { background: linear-gradient(160deg, rgba(43, 33, 15, 0.82), rgba(11, 21, 34, 0.96)); }
.portfolio-tax-page .evaluator-step-card.tone-risk,
.portfolio-tax-page .audit-holding-card.tone-risk { background: linear-gradient(160deg, rgba(43, 20, 20, 0.82), rgba(11, 21, 34, 0.96)); }

/* ============================================
   GLOBAL — HEADER & NAV POLISH
   ============================================ */

/* --- Logo: subtle gradient text --- */
.logo {
    background: linear-gradient(125deg, #f8fafc 30%, #8ecdf5 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    color: transparent;
}

/* --- beta-tag: cyan pill --- */
.beta-tag {
    border-color: rgba(57, 194, 255, 0.45);
    background: rgba(57, 194, 255, 0.08);
    color: rgba(57, 194, 255, 0.88);
    -webkit-text-fill-color: rgba(57, 194, 255, 0.88);
    font-weight: 800;
    letter-spacing: 0.1em;
}

/* --- Desktop nav links: base + active + hover --- */
@media (min-width: 901px) {
    .nav-link {
        font-size: 0.86rem;
        font-weight: 600;
        color: var(--text-secondary);
        text-decoration: none;
        padding: 0.28rem 0;
        position: relative;
        transition: color 0.12s;
    }
    .nav-link::after {
        content: "";
        position: absolute;
        left: 0;
        right: 0;
        bottom: -2px;
        height: 2px;
        background: rgba(57, 194, 255, 0.6);
        border-radius: 2px;
        transform: scaleX(0);
        transition: transform 0.15s ease;
    }
    .nav-link:hover {
        color: var(--text-primary);
    }
    .nav-link:hover::after {
        transform: scaleX(0.6);
    }
    .nav-link.active {
        color: #d6f2ff;
        font-weight: 700;
    }
    .nav-link.active::after {
        transform: scaleX(1);
        background: rgba(57, 194, 255, 0.75);
    }
}

/* --- Header search: cyan glow on focus --- */
.header-stock-search input:focus {
    border-color: rgba(57, 194, 255, 0.45) !important;
    box-shadow: 0 0 0 3px rgba(57, 194, 255, 0.1) !important;
}

/* --- hero: add cyan top accent --- */
.home-v2-hero {
    border-top: 2px solid rgba(57, 194, 255, 0.3);
}

/* ============================================
   GLOBAL — PORTFOLIO PAGE SIDEBAR POLISH
   ============================================ */

/* --- sidebar: subtle gradient bg + accent border --- */
@media (min-width: 769px) {
    .portfolio-page .sidebar {
        background: linear-gradient(180deg, rgba(9, 18, 34, 0.92), rgba(7, 14, 26, 0.96));
        border-right: 1px solid rgba(51, 89, 127, 0.18);
    }
}

/* --- sidebar portfolio count badge --- */
.portfolio-page .sidebar-count {
    background: rgba(57, 194, 255, 0.1);
    border: 1px solid rgba(57, 194, 255, 0.22);
    color: rgba(57, 194, 255, 0.8);
    font-size: 0.68rem;
    font-weight: 700;
    padding: 0.1rem 0.4rem;
    border-radius: 999px;
}

/* --- create-p-btn: more distinct look --- */
.portfolio-page .create-p-btn {
    border-style: dashed;
    opacity: 0.72;
    transition: opacity 0.12s, border-color 0.12s;
}
.portfolio-page .create-p-btn:hover {
    opacity: 1;
    border-color: rgba(57, 194, 255, 0.42);
    color: rgba(57, 194, 255, 0.88);
}

/* ============================================================
   GLOBAL — BUTTON HOVER & INTERACTION POLISH
   ============================================================ */
.btn-primary {
    transition: opacity 0.15s, transform 0.15s, box-shadow 0.15s;
}
.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(57, 194, 255, 0.2);
}
.btn-secondary {
    transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.btn-secondary:hover {
    background: rgba(57, 194, 255, 0.08);
    border-color: rgba(57, 194, 255, 0.38);
    color: #d6f2ff;
}

/* Home hero glow */
.home-v2-hero {
    box-shadow: 0 0 48px rgba(57, 194, 255, 0.08), 0 26px 56px rgba(0, 0, 0, 0.36);
}

/* Hero search-box focus ring */
.search-box:focus-within {
    border-color: rgba(57, 194, 255, 0.45) !important;
    box-shadow: 0 0 0 3px rgba(57, 194, 255, 0.1) !important;
}

/* Stock preview row hover */
.stock-preview-row:hover,
.search-result-item:hover {
    background: rgba(57, 194, 255, 0.06);
}

/* ============================================================
   ACCOUNTING PAGE — TABLE COLOR SEMANTICS & LAYOUT POLISH
   ============================================================ */

/* Debit/credit/balance column colors */
.col-debit   { color: rgba(248, 113, 113, 0.9); }
.col-credit  { color: rgba(52, 211, 153, 0.9); }
.col-positive { color: rgba(52, 211, 153, 0.78); }
.col-negative { color: rgba(248, 113, 113, 0.88); }
.col-muted   { color: rgba(100, 116, 139, 0.5); }

/* Tax breakdown: year group header rows */
.portfolio-accounting-page .accounting-tax-breakdown .accounting-year-group-row td {
    background: rgba(57, 194, 255, 0.06);
    border-top: 1px solid rgba(57, 194, 255, 0.18);
    padding-top: 10px;
    padding-bottom: 10px;
    font-size: 0.85rem;
    letter-spacing: 0.02em;
}
.portfolio-accounting-page .accounting-tax-breakdown {
    margin-bottom: 1rem;
}

/* Table row hover for accounting tables */
.portfolio-accounting-page .accounting-history-table tbody tr:hover,
.portfolio-accounting-page .accounting-secondary-grid table tbody tr:hover {
    background: rgba(57, 194, 255, 0.04);
    transition: background 0.1s;
}

/* Summary grid: 3-col on accounting page desktop to avoid orphan card */
.portfolio-accounting-page .accounting-summary-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}
/* 2-col at 640-900px (override the global 1-col rule for accounting) */
@media (max-width: 900px) and (min-width: 640px) {
    .portfolio-accounting-page .accounting-summary-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

/* Cash balance card: primary metric emphasis */
.portfolio-accounting-page .accounting-summary-grid .summary-card:first-child {
    border-top: 2px solid rgba(57, 194, 255, 0.4);
}
.portfolio-accounting-page .accounting-summary-grid .summary-card:first-child .value {
    font-size: 1.6rem;
    font-weight: 800;
}

/* Tone summary cards: colored top border */
.portfolio-accounting-page .accounting-summary-grid .summary-card.tone-good {
    border-top: 2px solid rgba(58, 177, 110, 0.5);
}
.portfolio-accounting-page .accounting-summary-grid .summary-card.tone-warn {
    border-top: 2px solid rgba(208, 158, 53, 0.5);
}
.portfolio-accounting-page .accounting-summary-grid .summary-card.tone-risk {
    border-top: 2px solid rgba(199, 89, 89, 0.5);
}

/* Allocation card: colored top border */
.accounting-allocation-card.tone-good { border-top: 2px solid rgba(58, 177, 110, 0.5); }
.accounting-allocation-card.tone-warn { border-top: 2px solid rgba(208, 158, 53, 0.5); }
.accounting-allocation-card.tone-risk { border-top: 2px solid rgba(199, 89, 89, 0.5); }

/* Entry panel open-state: top accent + separator under summary */
.accounting-entry-panel[open] {
    border-top: 2px solid rgba(57, 194, 255, 0.35);
}
.accounting-entry-panel[open] > summary {
    border-bottom: 1px solid rgba(51, 89, 127, 0.22);
}

/* Disclosure indicator on summary elements */
.accounting-entry-panel > summary::before,
.accounting-detail-card > summary::before {
    content: "▶";
    display: inline-block;
    margin-right: 0.45rem;
    font-size: 0.65rem;
    opacity: 0.55;
    transition: transform 0.18s;
    transform: rotate(0deg);
}
.accounting-entry-panel[open] > summary::before,
.accounting-detail-card[open] > summary::before {
    transform: rotate(90deg);
    opacity: 0.85;
}

/* Filter form: align submit button inline on desktop */
@media (min-width: 901px) {
    .portfolio-accounting-page .accounting-filter-form {
        grid-template-columns: repeat(4, minmax(0, 1fr)) auto;
        align-items: end;
    }
    .portfolio-accounting-page .accounting-filter-form button[type="submit"] {
        min-height: 2.8rem;
        white-space: nowrap;
    }
}

/* Allocation kicker: subtle badge */
.allocation-kicker {
    display: inline-block;
    background: rgba(57, 194, 255, 0.08);
    border: 1px solid rgba(57, 194, 255, 0.18);
    border-radius: 6px;
    padding: 0.16rem 0.5rem;
    color: rgba(57, 194, 255, 0.72);
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.09em;
    text-transform: uppercase;
}
.accounting-allocation-card.tone-risk .allocation-kicker {
    background: rgba(239, 68, 68, 0.08);
    border-color: rgba(239, 68, 68, 0.22);
    color: rgba(248, 113, 113, 0.82);
}

/* Delete button: danger style */
.accounting-row-actions .btn-inline[type="submit"] {
    color: rgba(248, 113, 113, 0.75);
    border-color: rgba(239, 68, 68, 0.22);
}
.accounting-row-actions .btn-inline[type="submit"]:hover {
    background: rgba(239, 68, 68, 0.08);
    border-color: rgba(239, 68, 68, 0.4);
    color: rgba(248, 113, 113, 1);
}

/* ============================================================
   EVALUATOR PAGE — COLLAPSIBLE HOLDINGS & COMPACT STEPS
   ============================================================ */

/* --- Holding cards as <details> --- */
details.audit-holding-card {
    overflow: hidden;
}
details.audit-holding-card > summary {
    list-style: none;
    cursor: pointer;
    user-select: none;
    padding: 0.92rem 0.98rem;
    display: block;
}
details.audit-holding-card > summary::-webkit-details-marker,
details.audit-holding-card > summary::marker {
    display: none;
}
/* Disclosure arrow on the holding header right side */
details.audit-holding-card > summary .audit-holding-header::after {
    content: "▾";
    display: inline-block;
    flex-shrink: 0;
    margin-left: auto;
    padding-left: 0.5rem;
    font-size: 0.7rem;
    color: rgba(148, 163, 184, 0.45);
    transition: transform 0.15s;
    align-self: center;
}
details.audit-holding-card[open] > summary .audit-holding-header::after {
    transform: rotate(180deg);
    color: rgba(148, 163, 184, 0.7);
}
/* Open state: separator under summary */
details.audit-holding-card[open] > summary {
    border-bottom: 1px solid rgba(51, 89, 127, 0.22);
}
/* Content padding */
details.audit-holding-card > .audit-step-list {
    padding: 0.82rem 0.98rem 0.92rem;
    margin-top: 0;
}
details.audit-holding-card > .audit-holding-factors {
    padding: 0.5rem 0.98rem 0.92rem;
    margin-top: 0;
    border-top: 1px solid rgba(51, 89, 127, 0.15);
}

/* Tone top border on holding cards */
.audit-holding-card.tone-good {
    border-top: 2px solid rgba(58, 177, 110, 0.5) !important;
}
.audit-holding-card.tone-warn {
    border-top: 2px solid rgba(208, 158, 53, 0.5) !important;
}
.audit-holding-card.tone-risk {
    border-top: 2px solid rgba(199, 89, 89, 0.5) !important;
}

/* --- Compact horizontal audit-step-row on evaluator pages --- */
.portfolio-evaluator-page .audit-step-row,
.portfolio-evaluator-run-page .audit-step-row {
    display: grid;
    grid-template-columns: 7rem 1fr;
    grid-template-rows: auto auto;
    column-gap: 0.65rem;
    row-gap: 0.1rem;
    align-items: start;
}
.portfolio-evaluator-page .audit-step-row-title,
.portfolio-evaluator-run-page .audit-step-row-title {
    grid-row: 1 / 3;
    grid-column: 1;
    font-size: 0.67rem;
    letter-spacing: 0.06em;
    padding-top: 0.1rem;
    padding-right: 0.55rem;
    border-right: 1px solid rgba(51, 89, 127, 0.22);
    line-height: 1.35;
    color: rgba(100, 116, 139, 0.88);
    align-self: start;
}
.portfolio-evaluator-page .audit-step-row-value,
.portfolio-evaluator-run-page .audit-step-row-value {
    grid-row: 1;
    grid-column: 2;
    margin-top: 0;
    font-size: 0.9rem;
    font-weight: 700;
    line-height: 1.35;
    overflow-wrap: anywhere;
}
.portfolio-evaluator-page .audit-step-row-detail,
.portfolio-evaluator-run-page .audit-step-row-detail {
    grid-row: 2;
    grid-column: 2;
    margin-top: 0;
    font-size: 0.78rem;
    color: rgba(100, 116, 139, 0.88);
    line-height: 1.4;
    overflow-wrap: anywhere;
}

/* Full-width row spans all step-list columns (fix class alias) */
.portfolio-evaluator-page .audit-step-row-wide,
.portfolio-evaluator-page .audit-step-row-full,
.portfolio-evaluator-run-page .audit-step-row-wide,
.portfolio-evaluator-run-page .audit-step-row-full {
    grid-column: 1 / -1;
    grid-template-columns: 7rem 1fr;
}

/* Tone coloring on step rows */
.portfolio-evaluator-page .audit-step-row.tone-good .audit-step-row-value,
.portfolio-evaluator-run-page .audit-step-row.tone-good .audit-step-row-value {
    color: rgba(52, 211, 153, 0.92);
}
.portfolio-evaluator-page .audit-step-row.tone-warn .audit-step-row-value,
.portfolio-evaluator-run-page .audit-step-row.tone-warn .audit-step-row-value {
    color: rgba(251, 191, 36, 0.92);
}
.portfolio-evaluator-page .audit-step-row.tone-risk .audit-step-row-value,
.portfolio-evaluator-run-page .audit-step-row.tone-risk .audit-step-row-value {
    color: rgba(248, 113, 113, 0.92);
}

/* --- Delta groups: visual separation --- */
.delta-group {
    margin-top: 0.85rem;
    padding-top: 0.72rem;
    border-top: 1px solid rgba(51, 89, 127, 0.18);
}
.delta-group:first-of-type {
    margin-top: 0.5rem;
    padding-top: 0;
    border-top: none;
}
.delta-group-label {
    font-size: 0.67rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: rgba(100, 116, 139, 0.65);
    margin: 0 0 0.45rem;
}
/* Semantic chip variants for delta */
.detail-chip.chip-changed {
    border-color: rgba(57, 194, 255, 0.3);
    color: rgba(57, 194, 255, 0.85);
}
.detail-chip.chip-added {
    border-color: rgba(58, 177, 110, 0.3);
    color: rgba(52, 211, 153, 0.85);
}
.detail-chip.chip-removed {
    border-color: rgba(199, 89, 89, 0.28);
    color: rgba(248, 113, 113, 0.82);
}
.detail-chip.chip-meta {
    opacity: 0.7;
    font-size: 0.72rem;
}

/* --- History table: score color-coding --- */
.score-tone-good { color: rgba(52, 211, 153, 0.9); }
.score-tone-warn { color: rgba(251, 191, 36, 0.9); font-weight: 700; }
.score-tone-risk { color: rgba(248, 113, 113, 0.9); font-weight: 700; }

/* History table row hover */
.portfolio-evaluator-page .evaluator-history-table tbody tr:hover,
.portfolio-evaluator-run-page .evaluator-history-table tbody tr:hover {
    background: rgba(57, 194, 255, 0.04);
}

/* Diff group headings */
.evaluator-diff-group h4 {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: rgba(148, 163, 184, 0.65);
    margin: 0 0 0.45rem;
}
.evaluator-diff-group .detail-list li {
    font-size: 0.8rem;
    line-height: 1.55;
}

/* ============================================================
   Evaluator cleanup — Task 4 supporting styles
   ============================================================ */

/* Fix: accounting-summary-grid wraps top-stats-primary/secondary in a
   4-col grid on the evaluator page, crushing the inner auto-fit grids.
   Override to a simple flex column so each stats block takes full width. */
.portfolio-evaluator-page .accounting-summary-grid,
.portfolio-evaluator-run-page .accounting-summary-grid {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

/* Primary stats block: subtle cyan top-border on each card */
.portfolio-evaluator-page .top-stats-primary .summary-card,
.portfolio-evaluator-run-page .top-stats-primary .summary-card {
    border-top: 2px solid rgba(57, 194, 255, 0.22);
}

/* Secondary stats: smaller value font and tighter chips */
.portfolio-evaluator-page .top-stats-secondary .summary-card .value,
.portfolio-evaluator-run-page .top-stats-secondary .summary-card .value {
    font-size: 1.15rem;
    font-weight: 700;
}
.portfolio-evaluator-page .top-stats-secondary .detail-chip-row .detail-chip,
.portfolio-evaluator-run-page .top-stats-secondary .detail-chip-row .detail-chip {
    font-size: 0.72rem;
    min-height: 1.7rem;
    padding: 0.15rem 0.48rem;
}

/* kv-list / kv-row — key-value pairs (score components, etc.) */
.kv-list {
    display: grid;
    gap: 0.3rem;
    margin-top: 0.35rem;
}
.kv-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 0.5rem;
    font-size: 0.78rem;
    padding: 0.12rem 0;
    border-bottom: 1px solid rgba(51, 89, 127, 0.12);
}
.kv-row:last-child {
    border-bottom: none;
}
.kv-label {
    color: rgba(148, 163, 184, 0.75);
    flex-shrink: 0;
}
.kv-value {
    font-weight: 700;
    color: rgba(226, 232, 240, 0.92);
    font-variant-numeric: tabular-nums;
    text-align: right;
}
.kv-value.tone-good { color: rgba(52, 211, 153, 0.9); }
.kv-value.tone-risk { color: rgba(248, 113, 113, 0.9); }

/* chip-row-context: smaller, dimmer contextual metadata chips */
.chip-row-context .detail-chip {
    font-size: 0.71rem;
    min-height: 1.75rem;
    padding: 0.18rem 0.5rem;
    opacity: 0.78;
}

/* sector-detail-chips: slightly smaller chips inside sector backdrop cards */
.sector-detail-chips .detail-chip {
    font-size: 0.73rem;
    min-height: 1.8rem;
}

/* Priority banner tone left-border accents */
.portfolio-priority-banner.tone-good { border-left: 3px solid rgba(58, 177, 110, 0.55); }
.portfolio-priority-banner.tone-warn { border-left: 3px solid rgba(208, 158, 53, 0.55); }
.portfolio-priority-banner.tone-risk { border-left: 3px solid rgba(199, 89, 89, 0.55); }

/* Priority chip hover */
.portfolio-priority-chip:hover {
    background: rgba(57, 194, 255, 0.1);
    border-color: rgba(57, 194, 255, 0.35);
    color: rgba(214, 242, 255, 0.95);
}

/* Tone-colored detail chips (urgency labels, etc.) */
.detail-chip.tone-risk {
    border-color: rgba(199, 89, 89, 0.38);
    color: rgba(248, 113, 113, 0.92);
    background: rgba(239, 68, 68, 0.06);
}
.detail-chip.tone-warn {
    border-color: rgba(208, 158, 53, 0.38);
    color: rgba(251, 191, 36, 0.92);
    background: rgba(245, 158, 11, 0.06);
}
.detail-chip.tone-good {
    border-color: rgba(58, 177, 110, 0.38);
    color: rgba(52, 211, 153, 0.92);
    background: rgba(16, 185, 129, 0.06);
}

/* Dimmed label prefix inside a chip (e.g. "Weight in portfolio: 15.3%") */
.chip-label {
    opacity: 0.65;
    font-size: 0.82em;
    font-weight: 400;
}

/* Secondary score number inside a chip (e.g. urgency score) */
.chip-score {
    opacity: 0.55;
    font-size: 0.8em;
    font-weight: 400;
    margin-left: 0.38em;
}

/* Replacement reason tags row — visible in summary without expanding */
.replacement-reason-chips {
    padding: 0.2rem 0.98rem 0.6rem;
    margin-top: 0;
    gap: 0.3rem;
}
.replacement-reason-chips .detail-chip,
.detail-chip.chip-reason {
    font-size: 0.7rem;
    min-height: 1.6rem;
    padding: 0.1rem 0.42rem;
    background: rgba(57, 194, 255, 0.04);
    border-color: rgba(57, 194, 255, 0.16);
    color: rgba(148, 163, 184, 0.85);
}

/* When a step row has no value, let the detail span both rows */
.portfolio-evaluator-page .audit-step-row-value:empty,
.portfolio-evaluator-run-page .audit-step-row-value:empty {
    display: none;
}
.portfolio-evaluator-page .audit-step-row:has(.audit-step-row-value:empty) .audit-step-row-detail,
.portfolio-evaluator-run-page .audit-step-row:has(.audit-step-row-value:empty) .audit-step-row-detail {
    grid-row: 1 / 3;
    align-self: center;
}

/* evaluator-detail-grid: widen to 3 cols at larger screens */
@media (min-width: 1200px) {
    .portfolio-evaluator-page .evaluator-detail-grid,
    .portfolio-evaluator-run-page .evaluator-detail-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

/* ── Sidebar AI Agent cards ───────────────────────────────────── */
.sidebar-agents-section {
    margin-top: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}
.sidebar-agents-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 0.25rem 0.25rem;
}
.sidebar-agents-label {
    font-size: 0.64rem;
    font-weight: 600;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    color: var(--text-muted, rgba(255,255,255,0.45));
}
.sidebar-agents-soon {
    font-size: 0.62rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: rgba(57,194,255,0.7);
    background: rgba(57,194,255,0.1);
    border: 1px solid rgba(57,194,255,0.2);
    border-radius: 4px;
    padding: 1px 5px;
}
.sidebar-agent-card {
    display: flex;
    align-items: flex-start;
    gap: 0.65rem;
    padding: 0.65rem 0.75rem;
    border-radius: 8px;
    background: rgba(255,255,255,0.03);
    border: 1px solid rgba(255,255,255,0.07);
    opacity: 0.72;
    transition: opacity 0.15s;
}
.sidebar-agent-card--cyan  { border-left: 2px solid rgba(57,194,255,0.35); }
.sidebar-agent-card--amber { border-left: 2px solid rgba(251,191,36,0.35); }
.sidebar-agent-card--purple{ border-left: 2px solid rgba(168,85,247,0.35); }
.sidebar-agent-avatar {
    flex-shrink: 0;
    width: 2.25rem;
    height: 2.25rem;
    border-radius: 50%;
}
.sidebar-agent-avatar--cyan {
    background: radial-gradient(circle at 35% 35%, rgba(57,194,255,0.55), rgba(57,194,255,0.08));
    border: 1px solid rgba(57,194,255,0.3);
}
.sidebar-agent-avatar--amber {
    background: radial-gradient(circle at 35% 35%, rgba(251,191,36,0.55), rgba(251,191,36,0.08));
    border: 1px solid rgba(251,191,36,0.3);
}
.sidebar-agent-avatar--purple {
    background: radial-gradient(circle at 35% 35%, rgba(168,85,247,0.55), rgba(168,85,247,0.08));
    border: 1px solid rgba(168,85,247,0.3);
}
.sidebar-agent-body {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}
.sidebar-agent-name {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-primary, rgba(255,255,255,0.9));
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.sidebar-agent-role {
    font-size: 0.7rem;
    color: var(--text-muted, rgba(255,255,255,0.45));
    line-height: 1.3;
    margin-bottom: 0.35rem;
}
.sidebar-agent-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.72rem;
    font-weight: 600;
    padding: 0.25rem 0.6rem;
    border-radius: 5px;
    border: 1px solid rgba(255,255,255,0.12);
    background: rgba(255,255,255,0.05);
    color: rgba(255,255,255,0.35);
    cursor: not-allowed;
    width: fit-content;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.sidebar-agent-btn:not([disabled]) {
    color: rgba(57,194,255,0.9);
    border-color: rgba(57,194,255,0.35);
    background: rgba(57,194,255,0.08);
    cursor: pointer;
}
.sidebar-agent-btn:not([disabled]):hover {
    background: rgba(57,194,255,0.16);
    border-color: rgba(57,194,255,0.6);
    color: #39c2ff;
}
.sidebar-agent-cost {
    font-size: 0.65rem;
    font-weight: 500;
    color: rgba(255,255,255,0.25);
    background: rgba(255,255,255,0.06);
    border-radius: 3px;
    padding: 0 4px;
}
.sidebar-agent-btn:not([disabled]) .sidebar-agent-cost {
    color: rgba(57,194,255,0.6);
    background: rgba(57,194,255,0.1);
}

/* ==========================================================
   IMPORT PAGE — broker picker + panels
   ========================================================== */

/* ── Broker picker ─────────────────────────────────────── */
.portfolio-import-page .broker-picker {
    margin: 0.5rem 0 1.1rem;
}

.portfolio-import-page .broker-picker-title {
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: var(--text-muted);
    margin: 0 0 0.55rem;
}

.portfolio-import-page .broker-picker-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 0.55rem;
}

.portfolio-import-page .broker-card {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.5rem 0.9rem;
    border-radius: 10px;
    border: 1px solid rgba(51, 89, 127, 0.28);
    background: rgba(9, 18, 31, 0.32);
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s, color 0.15s;
    user-select: none;
}

.portfolio-import-page .broker-card.is-active {
    border-color: rgba(57, 194, 255, 0.55);
    background: rgba(57, 194, 255, 0.08);
    color: rgba(57, 194, 255, 0.95);
    box-shadow: 0 0 0 1px rgba(57, 194, 255, 0.18) inset;
}

.portfolio-import-page .broker-card:not(.is-soon):hover {
    border-color: rgba(57, 194, 255, 0.38);
    background: rgba(57, 194, 255, 0.06);
    color: var(--text-primary);
}

.portfolio-import-page .broker-card.is-soon {
    opacity: 0.42;
    cursor: default;
}

.portfolio-import-page .broker-card-check {
    flex-shrink: 0;
    color: rgba(57, 194, 255, 0.9);
}

.portfolio-import-page .broker-soon-badge {
    font-size: 0.62rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    padding: 0.1rem 0.38rem;
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-muted);
}

/* ── Panel layout ──────────────────────────────────────── */
.portfolio-import-page .broker-panel {
    display: block;
}

.portfolio-import-page .broker-panel-cols {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

/* ── Guide card (left) ─────────────────────────────────── */
.portfolio-import-page .broker-guide-card {
    background: var(--bg-card);
    border: 1px solid rgba(51, 89, 127, 0.22);
    border-top: 2px solid rgba(57, 194, 255, 0.18);
    border-radius: 12px;
    padding: 1rem 1.1rem 0;
    overflow: hidden;
}

.portfolio-import-page .broker-guide-heading {
    display: flex;
    align-items: center;
    gap: 0.48rem;
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0 0 0.9rem;
}

.portfolio-import-page .broker-guide-heading svg {
    flex-shrink: 0;
    color: rgba(57, 194, 255, 0.65);
}

.portfolio-import-page .broker-guide-steps {
    list-style: none;
    margin: 0 0 1rem;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.portfolio-import-page .broker-guide-step {
    display: flex;
    align-items: flex-start;
    gap: 0.65rem;
}

.portfolio-import-page .broker-step-num {
    flex-shrink: 0;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: rgba(57, 194, 255, 0.13);
    border: 1px solid rgba(57, 194, 255, 0.3);
    color: rgba(57, 194, 255, 0.9);
    font-size: 0.7rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-top: 0.05rem;
}

.portfolio-import-page .broker-step-text {
    font-size: 0.83rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

.portfolio-import-page .broker-step-text strong {
    color: var(--text-primary);
    font-weight: 600;
}

/* Screenshot sits flush at the bottom of the guide card */
.portfolio-import-page .broker-screenshot-wrap {
    margin: 0 -1.1rem;
    padding: 0;
    border-top: 1px solid rgba(51, 89, 127, 0.18);
}

.portfolio-import-page .broker-screenshot-img {
    display: block;
    width: 100%;
    height: auto;
    border-radius: 0 0 11px 11px;
}

.portfolio-import-page .broker-screenshot-cap {
    font-size: 0.69rem;
    color: var(--text-muted);
    text-align: center;
    padding: 0.38rem 0.8rem 0.6rem;
    background: rgba(0, 0, 0, 0.18);
    border-radius: 0 0 11px 11px;
}

/* ── Upload card (right) ───────────────────────────────── */
.portfolio-import-page .broker-upload-card {
    background: var(--bg-card);
    border: 1px solid rgba(51, 89, 127, 0.22);
    border-top: 2px solid rgba(57, 194, 255, 0.28);
    border-radius: 12px;
    padding: 1rem 1.1rem 1.1rem;
}

.portfolio-import-page .broker-upload-head {
    display: flex;
    align-items: center;
    gap: 0.48rem;
    margin-bottom: 1rem;
    color: rgba(57, 194, 255, 0.65);
}

.portfolio-import-page .broker-upload-heading {
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
}

.portfolio-import-page .broker-upload-form {
    display: flex;
    flex-direction: column;
    gap: 0.72rem;
}

/* Drop zone */
.portfolio-import-page .broker-drop-zone {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.3rem;
    padding: 1.4rem 1rem;
    border: 2px dashed rgba(57, 194, 255, 0.22);
    border-radius: 10px;
    background: rgba(57, 194, 255, 0.04);
    cursor: pointer;
    text-align: center;
    transition: border-color 0.15s, background 0.15s;
}

.portfolio-import-page .broker-drop-zone:hover,
.portfolio-import-page .broker-drop-zone.is-dragging {
    border-color: rgba(57, 194, 255, 0.5);
    background: rgba(57, 194, 255, 0.09);
}

.portfolio-import-page .broker-drop-zone.has-file {
    border-color: rgba(16, 185, 129, 0.45);
    background: rgba(16, 185, 129, 0.06);
}

.portfolio-import-page .broker-drop-icon {
    color: rgba(57, 194, 255, 0.45);
    margin-bottom: 0.15rem;
    transition: color 0.15s;
}

.portfolio-import-page .broker-drop-zone:hover .broker-drop-icon,
.portfolio-import-page .broker-drop-zone.is-dragging .broker-drop-icon {
    color: rgba(57, 194, 255, 0.75);
}

.portfolio-import-page .broker-drop-zone.has-file .broker-drop-icon {
    color: rgba(16, 185, 129, 0.7);
}

.portfolio-import-page .broker-drop-text {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.portfolio-import-page .broker-drop-sub {
    font-size: 0.7rem;
    color: var(--text-muted);
}

.portfolio-import-page .broker-file-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
    pointer-events: none;
}

.portfolio-import-page .broker-filename {
    font-size: 0.76rem;
    color: rgba(16, 185, 129, 0.85);
    margin: -0.3rem 0 0;
    min-height: 1em;
    word-break: break-all;
}

/* Tax account row */
.portfolio-import-page .broker-form-row {
    display: flex;
    flex-direction: column;
    gap: 0.28rem;
}

.portfolio-import-page .broker-form-label {
    font-size: 0.69rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
}

.portfolio-import-page .broker-form-select {
    width: 100%;
    min-height: 38px;
    font-size: 0.82rem;
    background: var(--bg-root);
    border: 1px solid var(--border-active);
    color: #fff;
    padding: 0.38rem 0.6rem;
    border-radius: 8px;
}

/* Delete toggle */
.portfolio-import-page .broker-delete-toggle {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.6rem 0.75rem;
    border-radius: 9px;
    border: 1px solid rgba(51, 89, 127, 0.22);
    background: rgba(9, 18, 31, 0.28);
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s;
}

.portfolio-import-page .broker-delete-toggle:hover {
    border-color: rgba(239, 68, 68, 0.28);
    background: rgba(239, 68, 68, 0.04);
}

.portfolio-import-page .broker-delete-toggle input[type="checkbox"] {
    width: 15px;
    height: 15px;
    flex-shrink: 0;
    accent-color: #ef4444;
    cursor: pointer;
}

.portfolio-import-page .broker-delete-copy {
    display: flex;
    align-items: center;
    gap: 0.42rem;
    font-size: 0.81rem;
    color: var(--text-secondary);
}

.portfolio-import-page .broker-delete-copy svg {
    flex-shrink: 0;
    color: rgba(239, 68, 68, 0.55);
}

/* Delete warning */
.portfolio-import-page .broker-delete-warn {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    font-size: 0.78rem;
    color: #fbbf24;
    background: rgba(245, 158, 11, 0.08);
    border: 1px solid rgba(245, 158, 11, 0.22);
    border-radius: 8px;
    padding: 0.52rem 0.7rem;
}

.portfolio-import-page .broker-delete-warn svg {
    flex-shrink: 0;
    margin-top: 0.05rem;
    color: #f59e0b;
}

/* Submit button */
.portfolio-import-page .broker-submit-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.46rem;
    width: 100%;
    justify-content: center;
    min-height: 42px;
    font-size: 0.88rem;
    font-weight: 700;
    margin-top: 0.2rem;
}

/* ── Desktop: two-column layout ────────────────────────── */
@media (min-width: 769px) {
    .portfolio-import-page .broker-panel-cols {
        flex-direction: row;
        align-items: flex-start;
    }
    .portfolio-import-page .broker-guide-card {
        flex: 1 1 0;
        min-width: 0;
    }
    .portfolio-import-page .broker-upload-card {
        flex: 0 0 300px;
        width: 300px;
    }
}

/* ── View all transactions link ─────────────────────────── */
.portfolio-import-page .broker-view-tx-row {
    margin-top: 1.1rem;
    text-align: right;
}

.portfolio-import-page .broker-view-tx-link {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.73rem;
    font-weight: 600;
    color: rgba(57, 194, 255, 0.8);
    text-decoration: none;
    transition: color 0.15s;
}
.portfolio-import-page .broker-view-tx-link:hover {
    color: rgba(57, 194, 255, 1);
}

/* ── Mobile ─────────────────────────────────────────────── */
@media (max-width: 640px) {
    .portfolio-import-page .broker-drop-zone {
        padding: 1rem 0.75rem;
    }
    .portfolio-import-page .broker-submit-btn {
        min-height: 48px;
    }
}

/* ═══════════════════════════════════════════════════════════════════════
   PORTFOLIO TRANSACTIONS PAGE  (portfolio_transactions.php)
   ═══════════════════════════════════════════════════════════════════════ */

/* ── Page body ──────────────────────────────────────────── */
.portfolio-transactions-page .tx-page-body {
    padding: 0;
}

/* ── Toolbar ────────────────────────────────────────────── */
.portfolio-transactions-page .tx-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.65rem 0.9rem;
    background: var(--bg-card);
    border: 1px solid rgba(51, 89, 127, 0.22);
    border-radius: 10px;
    margin-bottom: 0.85rem;
}

.portfolio-transactions-page .tx-total-count {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    letter-spacing: 0.03em;
}

.portfolio-transactions-page .tx-import-link {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.73rem;
    font-weight: 600;
    color: rgba(57, 194, 255, 0.85);
    text-decoration: none;
    transition: color 0.15s;
}
.portfolio-transactions-page .tx-import-link:hover {
    color: rgba(57, 194, 255, 1);
}

/* ── Table container ────────────────────────────────────── */
.portfolio-transactions-page .tx-table-wrap {
    overflow-x: auto;
    border-radius: 10px;
    border: 1px solid rgba(51, 89, 127, 0.22);
    background: var(--bg-card);
    -webkit-overflow-scrolling: touch;
}

/* ── Table ──────────────────────────────────────────────── */
.portfolio-transactions-page .tx-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.78rem;
    min-width: 620px;
}

.portfolio-transactions-page .tx-table thead th {
    padding: 0.55rem 0.75rem;
    text-align: left;
    font-size: 0.64rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: var(--text-muted);
    background: rgba(0, 0, 0, 0.16);
    border-bottom: 1px solid rgba(51, 89, 127, 0.2);
    white-space: nowrap;
}

.portfolio-transactions-page .tx-table thead th.num,
.portfolio-transactions-page .tx-table td.num {
    text-align: right;
}

.portfolio-transactions-page .tx-table thead th.actions-head {
    text-align: right;
    width: 72px;
}

/* ── Display rows ───────────────────────────────────────── */
.portfolio-transactions-page .tx-display-row td {
    padding: 0.48rem 0.75rem;
    color: var(--text-secondary);
    border-bottom: 1px solid rgba(51, 89, 127, 0.1);
    white-space: nowrap;
    vertical-align: middle;
}

.portfolio-transactions-page .tx-display-row:last-of-type td,
.portfolio-transactions-page tbody tr:last-child td {
    border-bottom: none;
}

.portfolio-transactions-page .tx-display-row:hover td {
    background: rgba(57, 194, 255, 0.04);
}

.portfolio-transactions-page .tx-table td.date-cell {
    color: var(--text-muted);
    font-size: 0.73rem;
    font-variant-numeric: tabular-nums;
}

.portfolio-transactions-page .tx-table td.ticker-cell {
    font-weight: 700;
    color: var(--text-primary);
    font-family: monospace;
    font-size: 0.82rem;
    letter-spacing: 0.03em;
}

.portfolio-transactions-page .tx-table td.account-cell {
    font-size: 0.67rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    color: var(--text-muted);
}

/* ── Type badges ────────────────────────────────────────── */
.portfolio-transactions-page .tx-badge {
    display: inline-block;
    font-size: 0.61rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    padding: 0.12rem 0.45rem;
    border-radius: 4px;
}

.portfolio-transactions-page .tx-badge.buy {
    background: rgba(16, 185, 129, 0.14);
    color: #34d399;
}

.portfolio-transactions-page .tx-badge.sell {
    background: rgba(239, 68, 68, 0.14);
    color: #f87171;
}

/* ── Action buttons ─────────────────────────────────────── */
.portfolio-transactions-page .tx-actions {
    text-align: right;
    white-space: nowrap;
}

.portfolio-transactions-page .tx-delete-form {
    display: inline;
}

.portfolio-transactions-page .tx-btn-edit,
.portfolio-transactions-page .tx-btn-del {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    background: transparent;
    transition: background 0.15s, color 0.15s;
    padding: 0;
    vertical-align: middle;
}

.portfolio-transactions-page .tx-btn-edit {
    color: rgba(57, 194, 255, 0.7);
}
.portfolio-transactions-page .tx-btn-edit:hover {
    background: rgba(57, 194, 255, 0.1);
    color: rgba(57, 194, 255, 1);
}

.portfolio-transactions-page .tx-btn-del {
    color: rgba(248, 113, 113, 0.6);
    margin-left: 2px;
}
.portfolio-transactions-page .tx-btn-del:hover {
    background: rgba(239, 68, 68, 0.1);
    color: #f87171;
}

/* ── Edit row ───────────────────────────────────────────── */
.portfolio-transactions-page .tx-edit-row .tx-edit-cell {
    padding: 0.7rem 0.75rem;
    background: rgba(57, 194, 255, 0.04);
    border-bottom: 1px solid rgba(57, 194, 255, 0.12);
    border-top: 1px solid rgba(57, 194, 255, 0.12);
}

.portfolio-transactions-page .tx-edit-form {
    width: 100%;
}

.portfolio-transactions-page .tx-edit-grid {
    display: grid;
    grid-template-columns: 130px 90px 1fr 100px 110px 100px 110px auto;
    gap: 0.5rem;
    align-items: end;
}

.portfolio-transactions-page .tx-edit-field {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    min-width: 0;
}

.portfolio-transactions-page .tx-edit-field label {
    font-size: 0.6rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: var(--text-muted);
    white-space: nowrap;
}

.portfolio-transactions-page .tx-edit-field input,
.portfolio-transactions-page .tx-edit-field select {
    width: 100%;
    padding: 0.35rem 0.5rem;
    font-size: 0.77rem;
    background: rgba(0, 0, 0, 0.28);
    border: 1px solid rgba(51, 89, 127, 0.35);
    border-radius: 6px;
    color: var(--text-primary);
    transition: border-color 0.15s;
    min-width: 0;
    box-sizing: border-box;
}

.portfolio-transactions-page .tx-edit-field input:focus,
.portfolio-transactions-page .tx-edit-field select:focus {
    outline: none;
    border-color: rgba(57, 194, 255, 0.5);
}

/* ── Edit actions ───────────────────────────────────────── */
.portfolio-transactions-page .tx-edit-actions {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    padding-bottom: 1px;
}

.portfolio-transactions-page .tx-save-btn {
    padding: 0.38rem 0.75rem;
    font-size: 0.73rem;
    white-space: nowrap;
}

.portfolio-transactions-page .tx-cancel-btn {
    padding: 0.35rem 0.75rem;
    font-size: 0.73rem;
    font-weight: 600;
    color: var(--text-muted);
    background: transparent;
    border: 1px solid rgba(51, 89, 127, 0.3);
    border-radius: 6px;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.15s, color 0.15s;
}
.portfolio-transactions-page .tx-cancel-btn:hover {
    background: rgba(51, 89, 127, 0.12);
    color: var(--text-secondary);
}

/* ── Empty state ────────────────────────────────────────── */
.portfolio-transactions-page .tx-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.85rem;
    padding: 3rem 1.5rem;
    background: var(--bg-card);
    border: 1px solid rgba(51, 89, 127, 0.2);
    border-radius: 10px;
    color: var(--text-muted);
    text-align: center;
}

.portfolio-transactions-page .tx-empty-state svg {
    opacity: 0.35;
    color: rgba(57, 194, 255, 0.6);
}

.portfolio-transactions-page .tx-empty-state p {
    margin: 0;
    font-size: 0.83rem;
}

/* ── Mobile ─────────────────────────────────────────────── */
@media (max-width: 640px) {
    .portfolio-transactions-page .tx-edit-grid {
        grid-template-columns: 1fr 1fr;
        gap: 0.45rem;
    }

    .portfolio-transactions-page .tx-edit-actions {
        grid-column: 1 / -1;
        flex-direction: row;
        gap: 0.5rem;
    }

    .portfolio-transactions-page .tx-save-btn,
    .portfolio-transactions-page .tx-cancel-btn {
        flex: 1;
        text-align: center;
    }

    .portfolio-transactions-page .tx-toolbar {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.45rem;
    }
}

/* ── Filter tags bar ────────────────────────────────────── */
.portfolio-transactions-page .tx-filter-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-bottom: 0.75rem;
}

.portfolio-transactions-page .tx-filter-tag {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.28rem 0.7rem;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    border-radius: 20px;
    border: 1px solid rgba(51, 89, 127, 0.28);
    background: rgba(0, 0, 0, 0.18);
    color: var(--text-muted);
    text-decoration: none;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
    white-space: nowrap;
}

.portfolio-transactions-page .tx-filter-tag:hover {
    background: rgba(57, 194, 255, 0.07);
    border-color: rgba(57, 194, 255, 0.3);
    color: var(--text-secondary);
}

/* Active state — each type gets its own accent colour */
.portfolio-transactions-page .tx-filter-tag.is-active,
.portfolio-transactions-page .tx-filter-tag.all.is-active {
    background: rgba(57, 194, 255, 0.12);
    border-color: rgba(57, 194, 255, 0.45);
    color: rgba(57, 194, 255, 0.95);
}

.portfolio-transactions-page .tx-filter-tag.buy.is-active {
    background: rgba(16, 185, 129, 0.12);
    border-color: rgba(16, 185, 129, 0.45);
    color: #34d399;
}

.portfolio-transactions-page .tx-filter-tag.sell.is-active {
    background: rgba(239, 68, 68, 0.1);
    border-color: rgba(239, 68, 68, 0.4);
    color: #f87171;
}

.portfolio-transactions-page .tx-filter-tag.dividend.is-active {
    background: rgba(57, 194, 255, 0.1);
    border-color: rgba(57, 194, 255, 0.4);
    color: rgba(57, 194, 255, 0.9);
}

.portfolio-transactions-page .tx-filter-tag.tax.is-active,
.portfolio-transactions-page .tx-filter-tag.fee.is-active {
    background: rgba(245, 158, 11, 0.1);
    border-color: rgba(245, 158, 11, 0.4);
    color: #fbbf24;
}

.portfolio-transactions-page .tx-filter-tag.deposit.is-active {
    background: rgba(16, 185, 129, 0.08);
    border-color: rgba(16, 185, 129, 0.35);
    color: #6ee7b7;
}

.portfolio-transactions-page .tx-filter-count {
    font-size: 0.62rem;
    font-weight: 800;
    opacity: 0.75;
    font-variant-numeric: tabular-nums;
}

/* ── Sortable headers ───────────────────────────────────── */
.portfolio-transactions-page .tx-table thead th.sortable {
    padding: 0;
}

.portfolio-transactions-page .tx-table thead th.sortable a {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.55rem 0.75rem;
    color: var(--text-muted);
    text-decoration: none;
    transition: color 0.15s;
    white-space: nowrap;
}

.portfolio-transactions-page .tx-table thead th.sortable a:hover {
    color: rgba(57, 194, 255, 0.9);
}

.portfolio-transactions-page .tx-sort-arrow {
    font-size: 0.65rem;
    opacity: 0.4;
    font-style: normal;
}

.portfolio-transactions-page .tx-sort-arrow.active {
    opacity: 1;
    color: rgba(57, 194, 255, 0.9);
}

/* ── Ledger rows ────────────────────────────────────────── */
.portfolio-transactions-page .tx-ledger-row td {
    padding: 0.44rem 0.75rem;
    color: var(--text-secondary);
    border-bottom: 1px solid rgba(51, 89, 127, 0.08);
    white-space: nowrap;
    vertical-align: middle;
    background: rgba(0, 0, 0, 0.08);
}

.portfolio-transactions-page .tx-ledger-row:hover td {
    background: rgba(57, 194, 255, 0.03);
}

.portfolio-transactions-page .tx-table td.security-cell {
    color: var(--text-secondary);
    font-size: 0.78rem;
    max-width: 180px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.portfolio-transactions-page .tx-table td.pos { color: #34d399; }
.portfolio-transactions-page .tx-table td.neg { color: #f87171; }

/* Additional badge types for ledger entries */
.portfolio-transactions-page .tx-badge.dividend {
    background: rgba(57, 194, 255, 0.12);
    color: rgba(57, 194, 255, 0.9);
}

.portfolio-transactions-page .tx-badge.tax {
    background: rgba(245, 158, 11, 0.14);
    color: #fbbf24;
}

.portfolio-transactions-page .tx-badge.fee {
    background: rgba(245, 158, 11, 0.1);
    color: #fbbf24;
}

.portfolio-transactions-page .tx-badge.deposit {
    background: rgba(16, 185, 129, 0.1);
    color: #6ee7b7;
}

.portfolio-transactions-page .tx-badge.other {
    background: rgba(100, 116, 139, 0.14);
    color: var(--text-muted);
}

/* ── Stipulated (estimated) dividend rows ───────────────── */
.portfolio-transactions-page .tx-stipulated-row {
    opacity: 0.72;
}
.portfolio-transactions-page .tx-stipulated-mark {
    font-size: 0.7rem;
    color: rgba(245, 158, 11, 0.8);
    font-weight: 600;
    cursor: default;
    margin-left: 0.15em;
}
.portfolio-transactions-page .tx-stipulated-label {
    font-size: 0.65rem;
    color: rgba(245, 158, 11, 0.75);
    font-weight: 500;
    font-style: italic;
}

/* ── Pagination ─────────────────────────────────────────── */
.portfolio-transactions-page .tx-pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.6rem;
    padding: 0.85rem 0 0.25rem;
}

.portfolio-transactions-page .tx-page-btn {
    display: inline-flex;
    align-items: center;
    padding: 0.35rem 0.85rem;
    font-size: 0.73rem;
    font-weight: 600;
    border-radius: 6px;
    background: var(--bg-card);
    border: 1px solid rgba(51, 89, 127, 0.25);
    color: rgba(57, 194, 255, 0.8);
    text-decoration: none;
    transition: background 0.15s, border-color 0.15s;
}

.portfolio-transactions-page .tx-page-btn:hover {
    background: rgba(57, 194, 255, 0.07);
    border-color: rgba(57, 194, 255, 0.3);
}

.portfolio-transactions-page .tx-page-btn.is-disabled {
    color: var(--text-muted);
    cursor: default;
    opacity: 0.45;
    pointer-events: none;
}

.portfolio-transactions-page .tx-page-info {
    font-size: 0.72rem;
    color: var(--text-muted);
    font-variant-numeric: tabular-nums;
    min-width: 48px;
    text-align: center;
}

/* ================================================================
   COMPREHENSIVE MOBILE OPTIMIZATION — ALL PAGES
   Breakpoints: 900px (tablet), 640px (large mobile), 480px (small mobile)
   ================================================================ */

/* ── Model portfolio: top-stats-primary layout (no .portfolio-page prefix) ── */
.model-portfolio-page .top-stats-primary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 0.75rem;
}

/* ── Model portfolio pages — 640px breakpoint ── */
@media (max-width: 640px) {
    /* Action cards: tighter padding */
    .model-portfolio-action-card {
        padding: 14px 16px;
        border-radius: 18px;
        gap: 8px;
    }

    /* Alert rail: single column */
    .model-portfolio-alert-rail {
        grid-template-columns: 1fr;
    }

    /* Allocation grid: tighter gap at 640px (already 1-col from 900px rule) */
    .model-portfolio-allocation-grid {
        gap: 10px;
    }

    /* Panel: tighter padding */
    .model-portfolio-panel {
        padding: 0.9rem 1rem;
    }
    .model-portfolio-panel-head h2 {
        font-size: 0.92rem;
    }

    /* Card stats: stay 2-col at 640px (was reduced from 3 at 900px) */
    .model-portfolio-card-stats {
        gap: 8px;
    }
    .model-portfolio-card-stats > div {
        padding: 8px 10px;
    }

    /* Quick nav: tighter gap and font */
    .model-portfolio-quick-nav {
        gap: 0.35rem;
        font-size: 0.72rem;
    }

    /* Filter row: tighter spacing */
    .model-portfolio-filter-row {
        gap: 0.35rem;
    }
    .model-portfolio-filter-group {
        gap: 0.3rem;
    }

    /* Hero h1 scaling */
    .model-portfolio-page .directory-header h1 {
        font-size: clamp(1.5rem, 6vw, 2rem) !important;
    }

    /* Action eyebrow: slightly smaller */
    .model-portfolio-action-eyebrow {
        font-size: 0.67rem;
    }
    .model-portfolio-action-card h2 {
        font-size: 1rem;
    }
    .model-portfolio-action-card p {
        font-size: 0.83rem;
    }
}

/* ── Model portfolio pages — 480px breakpoint ── */
@media (max-width: 480px) {
    /* Card stats: 1 column on very small screens */
    .model-portfolio-card-stats {
        grid-template-columns: 1fr;
        gap: 6px;
    }

    /* Action cards: minimal padding */
    .model-portfolio-action-card {
        padding: 12px 14px;
        border-radius: 14px;
    }
    .model-portfolio-action-card h2 {
        font-size: 0.95rem;
    }

    /* Allocation grid: tighter gap at 480px (already 1-col from 900px rule) */
    .model-portfolio-allocation-grid {
        gap: 8px;
    }

    /* Activity strip: reduce minimum card width */
    .model-portfolio-activity-strip {
        grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
        gap: 8px;
    }

    /* KPI grid: 1 col */
    .model-portfolio-kpi-grid {
        grid-template-columns: 1fr !important;
    }

    /* Ensure model grid is single column */
    .model-portfolio-grid {
        grid-template-columns: 1fr !important;
    }

    /* Snapshot grid: 1 col */
    .model-portfolio-snapshot-grid {
        grid-template-columns: 1fr !important;
    }

    /* Hero main grid cells: tighter gap */
    .model-portfolio-hero-main,
    .model-portfolio-hero-side {
        gap: 10px;
    }
}

/* ── Portfolio dividends page — mobile ── */
@media (max-width: 640px) {
    .dividends-section-block {
        padding: 0.72rem 0.8rem;
        border-radius: 10px;
        margin-bottom: 0.9rem;
    }
    .dividends-section-heading {
        font-size: 0.63rem;
        margin-bottom: 0.65rem;
    }
    /* Value amounts in dividends stats: slightly smaller */
    .portfolio-dividends-page .value-amount {
        font-size: 1.2rem;
    }
}

@media (max-width: 480px) {
    .dividends-section-block {
        padding: 0.6rem 0.7rem;
    }
    .portfolio-dividends-page .value-amount {
        font-size: 1.05rem;
    }
}

/* ── Portfolio AI analysis page — mobile ── */
@media (max-width: 640px) {
    /* Tighter agent card header */
    .portfolio-ai-analysis-page .ai-analysis-section {
        margin-bottom: 1rem;
        border-radius: 9px;
    }
    .portfolio-ai-analysis-page .ai-analysis-agent-header {
        padding: 0.7rem 0.9rem;
        gap: 0.5rem;
    }
    /* Meta row: wrap fully and reduce gap */
    .portfolio-ai-analysis-page .ai-analysis-meta {
        gap: 0.35rem;
        margin-left: 0;
        width: 100%;
    }
    .portfolio-ai-analysis-page .ai-analysis-model {
        font-size: 0.63rem;
    }
    .portfolio-ai-analysis-page .ai-analysis-date,
    .portfolio-ai-analysis-page .ai-analysis-tokens {
        font-size: 0.67rem;
    }
    .portfolio-ai-analysis-page .ai-action-btn {
        font-size: 0.63rem;
        padding: 0.15rem 0.38rem;
        gap: 0.22rem;
    }
    .portfolio-ai-analysis-page .ai-analysis-agent-name {
        font-size: 0.88rem;
    }
    /* History toggle: tighter padding */
    .portfolio-ai-analysis-page .ai-analysis-history-toggle {
        padding: 0.6rem 0.9rem;
        font-size: 0.76rem;
    }
    /* History meta: tighter */
    .portfolio-ai-analysis-page .ai-analysis-history-meta {
        padding: 0.5rem 0.9rem;
        gap: 0.38rem;
    }
}

@media (max-width: 480px) {
    .portfolio-ai-analysis-page .ai-analysis-agent-header {
        padding: 0.6rem 0.72rem;
    }
    .portfolio-ai-analysis-page .ai-analysis-agent-icon {
        width: 28px;
        height: 28px;
        border-radius: 6px;
    }
    .portfolio-ai-analysis-page .ai-analysis-agent-icon svg {
        width: 14px;
        height: 14px;
    }
}

/* ── Portfolio accounting page — mobile ── */
@media (max-width: 640px) {
    /* Export buttons: stack vertically */
    .portfolio-accounting-page .accounting-export-group {
        flex-direction: column;
        gap: 0.42rem;
        width: 100%;
    }
    .portfolio-accounting-page .accounting-export-group .btn-secondary {
        width: 100%;
        text-align: center;
        justify-content: center;
    }
    /* Allocation card: compact */
    .accounting-allocation-card {
        padding: 0.82rem 0.9rem;
    }
    .accounting-allocation-card h3 {
        font-size: 0.9rem;
    }
    .accounting-allocation-card p {
        font-size: 0.78rem;
    }
}

/* ── Portfolio evaluator pages — sub-640px refinements ── */
@media (max-width: 640px) {
    /* Compact audit step rows */
    .portfolio-evaluator-page .audit-step-row,
    .portfolio-evaluator-run-page .audit-step-row {
        grid-template-columns: 5rem 1fr;
    }
    .portfolio-evaluator-page .audit-step-row-title,
    .portfolio-evaluator-run-page .audit-step-row-title {
        font-size: 0.61rem;
        padding-right: 0.42rem;
    }
    .portfolio-evaluator-page .audit-step-row-value,
    .portfolio-evaluator-run-page .audit-step-row-value {
        font-size: 0.83rem;
    }
    .portfolio-evaluator-page .audit-step-row-detail,
    .portfolio-evaluator-run-page .audit-step-row-detail {
        font-size: 0.74rem;
    }
    /* Step card: compact padding */
    .evaluator-step-card {
        padding: 0.72rem 0.82rem;
    }
    .evaluator-step-title { font-size: 0.62rem; }
    .evaluator-step-value { font-size: 0.9rem; }
}

/* ── Portfolio import page — 480px refinements ── */
@media (max-width: 480px) {
    .portfolio-import-page .broker-drop-zone {
        padding: 0.9rem 0.65rem;
    }
    .portfolio-import-page .broker-guide-steps {
        gap: 0.5rem;
    }
    .portfolio-import-page .broker-step-text {
        font-size: 0.79rem;
    }
}

/* ── Stocks detail page — 480px refinements ── */
@media (max-width: 480px) {
    /* Facts grid: 1 col on very small screens */
    .stock-detail-page .stock-facts-grid {
        grid-template-columns: 1fr;
    }
    /* Projection grid: reduce gap */
    .stock-detail-page .projection-grid {
        gap: 0.35rem;
    }
    /* Score matrix: slightly smaller font */
    .stock-detail-page .score-matrix {
        font-size: 0.74rem;
    }
}

/* ── General portfolio sub-pages: 480px refinements ── */
@media (max-width: 480px) {
    /* Portfolio title and chips: compact */
    .portfolio-page .portfolio-title {
        font-size: 1.1rem;
    }
    .portfolio-page .portfolio-page-subtitle {
        font-size: 0.76rem;
    }
    .portfolio-page .portfolio-chip {
        font-size: 0.65rem;
        padding: 0.14rem 0.38rem;
        min-height: 24px;
    }
    /* Section nav: smaller text */
    .portfolio-section-link {
        font-size: 0.76rem;
        padding: 0.5rem 0.78rem;
    }
}

/* ── Dividends page: table scroll indicator ── */
@media (max-width: 640px) {
    .portfolio-dividends-page .table-container {
        position: relative;
    }
    .portfolio-dividends-page .table-container::after {
        content: '';
        display: block;
        position: absolute;
        right: 0;
        top: 0;
        bottom: 0;
        width: 24px;
        background: linear-gradient(to right, transparent, rgba(10, 19, 31, 0.85));
        pointer-events: none;
        border-radius: 0 10px 10px 0;
    }
}

/* ── Model portfolio card footer: wrap on 480px ── */
@media (max-width: 480px) {
    .model-portfolio-card-footer {
        flex-wrap: wrap;
        gap: 8px;
    }
    .model-portfolio-card-actions {
        width: 100%;
        justify-content: flex-end;
    }
    .model-portfolio-card-actions .btn-secondary {
        flex: 1;
        text-align: center;
        justify-content: center;
    }
}

/* ================================================================
   TOP STAT CARD — base styles (model portfolio pages)
   Used in: model_portfolios.php, model_portfolio.php,
            model_portfolio_compare.php, model_portfolio_transactions.php
   ================================================================ */
.top-stat-card {
    background: rgba(12, 22, 40, 0.78);
    border: 1px solid rgba(51, 89, 127, 0.28);
    border-radius: 14px;
    padding: 1rem 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}
.top-stat-card label {
    font-size: 0.64rem;
    font-weight: 700;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    color: var(--text-muted, #64748b);
    cursor: default;
}
.top-stat-card strong {
    font-size: 1.45rem;
    font-weight: 800;
    color: var(--text-primary, #f1f5f9);
    letter-spacing: -0.025em;
    line-height: 1.1;
}
.top-stat-card-secondary strong {
    font-size: 1.15rem;
}
@media (max-width: 640px) {
    .top-stat-card {
        padding: 0.72rem 0.9rem;
        border-radius: 10px;
    }
    .top-stat-card strong {
        font-size: 1.25rem;
    }
}
@media (max-width: 480px) {
    .top-stat-card {
        padding: 0.6rem 0.75rem;
        border-radius: 9px;
    }
    .top-stat-card strong {
        font-size: 1.1rem;
    }
    .top-stat-card label {
        font-size: 0.6rem;
    }
}

