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

:root {
    /* Navy / midnight anchor */
    --navy: #0f2137;
    --navy-deep: #0a1628;
    --navy-mid: #1a3352;
    --navy-light: #2d4a66;
    /* Antique gold / brass */
    --gold: #9a7b4f;
    --gold-light: #b8985e;
    --gold-muted: #c9a86a;
    --gold-glow: rgba(154, 123, 79, 0.22);
    --gold-soft: rgba(154, 123, 79, 0.14);
    --gold-faint: rgba(154, 123, 79, 0.08);
    --gold-border: rgba(154, 123, 79, 0.45);
    /* Parchment / warm cream canvas */
    --parchment: #f4efe6;
    --parchment-deep: #e8e2d4;
    --cream: #faf8f3;
    --cream-card: #fffcf7;
    /* Surfaces (light theme) */
    --bg-primary: var(--parchment);
    --bg-secondary: var(--cream);
    --bg-card: var(--cream-card);
    --bg-input: #ffffff;
    --bg-hover: rgba(15, 33, 55, 0.06);
    --bg-detail: #f0ebe3;
    --border: rgba(15, 33, 55, 0.14);
    --border-subtle: rgba(15, 33, 55, 0.08);
    --border-hover: rgba(154, 123, 79, 0.45);
    --text-primary: var(--navy);
    --text-secondary: #3d4f66;
    --text-muted: #5c6b7a;
    /* Accents = gold (CTAs, focus rings) */
    --accent: var(--gold);
    --accent-hover: var(--gold-light);
    --accent-glow: var(--gold-glow);
    --accent-soft: var(--gold-soft);
    --header-bg: linear-gradient(180deg, var(--navy-deep) 0%, var(--navy) 100%);
    --header-text: #f5f0e6;
    --header-muted: rgba(245, 240, 230, 0.72);
    --green: #1d6b45;
    --green-soft: rgba(29, 107, 69, 0.12);
    --red: #b33a3a;
    --red-soft: rgba(179, 58, 58, 0.1);
    --purple: var(--navy-mid);
    --ticker-blue: #1e5570;
    --radius: 12px;
    --radius-sm: 8px;
    --radius-xs: 6px;
    --shadow-sm: 0 1px 3px rgba(10, 22, 40, 0.08);
    --shadow-md: 0 8px 24px rgba(10, 22, 40, 0.12);
    --transition: 0.15s ease;
}

body {
    font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

body.bro-funnel-open {
    overflow: hidden;
}

/* ---- Finance Bro funnel (first visit) ---- */

.bro-funnel-overlay {
    position: fixed;
    inset: 0;
    z-index: 200;
    background: rgba(10, 22, 40, 0.55);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.bro-funnel-overlay.hidden {
    display: none;
}

.bro-funnel-card {
    max-width: 440px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 28px 26px;
    box-shadow: var(--shadow-md);
}

.bro-funnel-card h2 {
    font-size: 1.35rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    margin-bottom: 12px;
}

.bro-funnel-lead {
    color: var(--text-secondary);
    font-size: 0.95rem;
    line-height: 1.55;
    margin-bottom: 10px;
}

.bro-funnel-note {
    font-size: 0.72rem;
    color: var(--text-muted);
    margin-bottom: 22px;
}

.bro-funnel-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.bro-funnel-primary {
    background: var(--navy);
    color: var(--header-text);
    border: 1px solid var(--gold-border);
    border: none;
    padding: 12px 18px;
    border-radius: var(--radius-xs);
    font-weight: 600;
    font-size: 0.92rem;
    cursor: pointer;
    font-family: inherit;
}

.bro-funnel-primary:hover {
    background: var(--navy-mid);
    border-color: var(--gold-light);
}

.bro-funnel-secondary {
    background: transparent;
    color: var(--text-muted);
    border: 1px solid var(--border);
    padding: 10px 18px;
    border-radius: var(--radius-xs);
    font-size: 0.88rem;
    cursor: pointer;
    font-family: inherit;
}

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

.bro-hear-btn {
    margin-right: 6px;
    padding: 6px 10px;
    font-size: 0.72rem;
    font-weight: 600;
    background: rgba(245, 240, 230, 0.1);
    border: 1px solid var(--gold-border);
    color: var(--header-text);
    border-radius: var(--radius-xs);
    cursor: pointer;
    font-family: inherit;
}

.bro-hear-btn:hover {
    border-color: var(--gold-light);
    color: var(--gold-muted);
}

.bro-hear-btn.hidden {
    display: none;
}

/* Collapsible filters (simpler default view) */

.filters-details {
    border-bottom: 1px solid var(--border);
    background: var(--bg-secondary);
}

.filters-summary {
    list-style: none;
    cursor: pointer;
    padding: 12px 32px;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-secondary);
    max-width: 1600px;
    margin: 0 auto;
    user-select: none;
}

.filters-summary::-webkit-details-marker {
    display: none;
}

.filters-summary::before {
    content: "▸";
    display: inline-block;
    margin-right: 8px;
    transition: transform var(--transition);
    color: var(--text-muted);
}

.filters-details[open] .filters-summary::before {
    transform: rotate(90deg);
}

.filters-summary-hint {
    font-weight: 400;
    color: var(--text-muted);
    font-size: 0.78rem;
}

/* ---- Header ---- */

header {
    border-bottom: 2px solid var(--gold-border);
    padding: 0 32px;
    position: sticky;
    top: 0;
    z-index: 50;
    background: var(--header-bg);
    box-shadow: var(--shadow-sm);
}

.header-content {
    max-width: 1600px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 0;
    gap: 20px;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 14px;
}

.logo-mark {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    padding: 4px;
    background: rgba(245, 240, 230, 0.06);
    border-radius: var(--radius-sm);
    border: 2px solid var(--gold-border);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.header-logo {
    display: block;
    height: 80px;
    width: auto;
    max-width: 280px;
    object-fit: contain;
}

header h1 {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--header-text);
    letter-spacing: -0.02em;
}

header h1 .header-title-bros {
    color: var(--navy-deep);
    background: var(--gold);
    padding: 0.1em 0.35em 0.12em;
    border-radius: var(--radius-xs);
}

.header-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.header-stats {
    display: flex;
    align-items: center;
    gap: 14px;
    font-size: 0.78rem;
}

.stat-chip {
    display: flex;
    align-items: center;
    gap: 6px;
    background: rgba(245, 240, 230, 0.08);
    border: 1px solid var(--gold-border);
    padding: 4px 12px;
    border-radius: 100px;
}

.stat-dot {
    width: 6px;
    height: 6px;
    background: var(--gold-light);
    border-radius: 50%;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

#fund-count {
    color: var(--gold-muted);
    font-weight: 600;
    font-size: 0.78rem;
}

#last-updated {
    color: var(--header-muted);
    font-size: 0.75rem;
}

#refresh-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: var(--gold);
    color: var(--navy-deep);
    border: none;
    padding: 8px 16px;
    border-radius: var(--radius-xs);
    cursor: pointer;
    font-size: 0.8rem;
    font-weight: 600;
    transition: all var(--transition);
    white-space: nowrap;
    font-family: inherit;
}

#refresh-btn:hover {
    background: var(--gold-light);
    box-shadow: 0 0 16px var(--gold-glow);
}

#refresh-btn:active { transform: scale(0.97); }

#refresh-btn:disabled {
    background: rgba(245, 240, 230, 0.15);
    color: var(--header-muted);
    cursor: not-allowed;
    box-shadow: none;
}

@keyframes spin {
    100% { transform: rotate(360deg); }
}
.spin { animation: spin 1s linear infinite; }

.gear {
    animation: spin 20s linear infinite;
    transform-origin: center;
    transform-box: fill-box;
}

@keyframes market-pulse {
    0%, 100% { transform: scaleY(1); }
    50% { transform: scaleY(1.1); }
}
.candle {
    animation: market-pulse 4s ease-in-out infinite;
    transform-origin: bottom;
    transform-box: fill-box;
}
.market-motif .candle:nth-child(1) { animation-delay: 0s; }
.market-motif .candle:nth-child(2) { animation-delay: 0.5s; }
.market-motif .candle:nth-child(3) { animation-delay: 1s; }
.market-motif .candle:nth-child(4) { animation-delay: 1.5s; }
.market-motif .candle:nth-child(5) { animation-delay: 2s; }

@keyframes trend-up {
    0%, 100% { transform: translate(0px, 0px); }
    50% { transform: translate(3px, -3px); }
}
.arrow {
    animation: trend-up 3s ease-in-out infinite;
    transform-box: fill-box;
}

.market-motif {
    max-width: 1600px;
    margin: 0 auto;
    padding: 0 32px;
    border-bottom: 1px solid var(--border);
    opacity: 0.92;
}
.market-motif-svg {
    display: block;
    width: min(320px, 100%);
    height: 36px;
    margin: 4px auto 6px;
}

/* ---- Filters ---- */

.filters-bar {
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
    padding: 0 32px;
}

.filters-inner {
    max-width: 1600px;
    margin: 0 auto;
    display: flex;
    align-items: flex-end;
    gap: 12px;
    padding: 14px 0;
    flex-wrap: wrap;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.filter-group label {
    font-size: 0.65rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-weight: 600;
}

select, input[type="text"] {
    background: var(--bg-input);
    border: 1px solid var(--border);
    color: var(--text-primary);
    padding: 8px 12px;
    border-radius: var(--radius-xs);
    font-size: 0.82rem;
    min-width: 160px;
    transition: all var(--transition);
    font-family: inherit;
}

select {
    padding-right: 32px;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg width='10' height='6' viewBox='0 0 10 6' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%230f2137' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    cursor: pointer;
}

select:hover, input[type="text"]:hover {
    border-color: var(--border-hover);
}

select:focus, input[type="text"]:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

.search-group {
    flex: 1;
    min-width: 180px;
    max-width: 280px;
}

.theme-group {
    min-width: 200px;
    max-width: 300px;
}

.search-wrapper {
    position: relative;
}

.search-icon {
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    pointer-events: none;
}

.search-wrapper input {
    padding-left: 32px;
    padding-right: 36px;
    width: 100%;
}

.search-mic {
    position: absolute;
    right: 6px;
    top: 50%;
    transform: translateY(-50%);
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color var(--transition), background var(--transition);
}

.search-mic:hover {
    color: var(--accent);
    background: var(--accent-soft);
}

.search-mic.recording {
    color: var(--red);
    animation: pulse 1s infinite;
}

/* ---- Finance Bro ---- */

.bro-mode-toggle {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    user-select: none;
    margin-right: 8px;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--header-text);
}

.bro-mode-toggle input {
    accent-color: var(--gold-light);
    width: 16px;
    height: 16px;
}

.bro-mode-label {
    white-space: nowrap;
}

.bro-panel {
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
    padding: 16px 32px 20px;
}

.bro-panel.hidden {
    display: none;
}

.bro-panel-inner {
    max-width: 1600px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: 1fr 320px;
    gap: 24px;
    align-items: start;
}

@media (max-width: 1024px) {
    .bro-panel-inner {
        grid-template-columns: 1fr;
    }
}

.bro-chat-soundbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 8px 14px;
    margin-bottom: 10px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border-subtle);
}

.bro-soundbar-title {
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    font-weight: 600;
}

.bro-sound-controls {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.bro-mute-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    font-size: 0.72rem;
    font-weight: 600;
    font-family: inherit;
    color: var(--text-primary);
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-xs);
    cursor: pointer;
    transition: background var(--transition), border-color var(--transition);
}

.bro-mute-btn:hover {
    border-color: var(--gold-border);
    background: var(--bg-input);
}

.bro-mute-btn[aria-pressed="true"] {
    color: var(--text-muted);
}

.bro-voice-icon {
    display: inline-flex;
    vertical-align: middle;
}

.bro-volume-label {
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
}

.bro-volume {
    width: 100px;
    min-width: 72px;
    max-width: 160px;
    accent-color: var(--gold-light);
    cursor: pointer;
}

.bro-sound-hint {
    flex-basis: 100%;
    margin: 0;
    font-size: 0.65rem;
    color: var(--text-muted);
    line-height: 1.35;
    max-width: 42rem;
}

.bro-onboarding {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 14px 16px 16px;
    margin-bottom: 10px;
}

.bro-onboarding.hidden {
    display: none;
}

.bro-onboarding-title {
    margin: 0 0 6px;
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-primary);
}

.bro-onboarding-lead {
    margin: 0 0 12px;
    font-size: 0.8rem;
    color: var(--text-muted);
    line-height: 1.4;
}

.bro-onboarding-fields {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 14px;
}

.bro-onboarding-field label {
    display: block;
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.bro-onboard-input {
    width: 100%;
    max-width: 320px;
    box-sizing: border-box;
    background: var(--bg-input);
    border: 1px solid var(--border);
    color: var(--text-primary);
    padding: 8px 10px;
    border-radius: var(--radius-xs);
    font-size: 0.88rem;
    font-family: inherit;
}

.bro-onboarding-hint {
    display: block;
    margin-top: 5px;
    font-size: 0.68rem;
    font-weight: 400;
    text-transform: none;
    letter-spacing: 0;
    color: var(--text-muted);
    line-height: 1.35;
}

.bro-onboarding-continue {
    padding: 8px 18px;
    font-size: 0.85rem;
    font-weight: 600;
    font-family: inherit;
    color: var(--header-text);
    background: var(--navy);
    border: 1px solid var(--gold-border);
    border-radius: var(--radius-xs);
    cursor: pointer;
}

.bro-onboarding-continue:hover {
    background: var(--navy-mid);
}

.bro-personality {
    background: var(--bg-input);
    border: 1px solid var(--border);
    color: var(--text-primary);
    padding: 4px 8px;
    border-radius: var(--radius-xs);
    font-size: 0.72rem;
    font-family: inherit;
    cursor: pointer;
    min-width: 110px;
}

.bro-personality:focus {
    border-color: var(--gold-border);
    outline: none;
}

.bro-chat-thread.hidden {
    display: none;
}

.bro-messages {
    min-height: 120px;
    max-height: 280px;
    overflow-y: auto;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 12px 14px;
    font-size: 0.88rem;
    margin-bottom: 10px;
}

.bro-msg {
    margin-bottom: 10px;
    line-height: 1.45;
}

.bro-msg.user {
    color: var(--text-secondary);
}

.bro-msg.assistant {
    color: var(--text-primary);
}

.bro-msg .bro-role {
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    margin-bottom: 4px;
}

.bro-msg.error {
    color: var(--red);
}

.bro-quick-prompts {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 10px;
    margin-bottom: 10px;
}

.bro-quick-prompts-label {
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    font-weight: 600;
    margin-right: 2px;
}

.bro-quick-btn {
    display: inline-flex;
    align-items: center;
    padding: 6px 11px;
    font-size: 0.72rem;
    font-weight: 500;
    font-family: inherit;
    color: var(--text-primary);
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 100px;
    cursor: pointer;
    transition: border-color var(--transition), background var(--transition);
    white-space: nowrap;
}

.bro-quick-btn:hover {
    border-color: var(--gold-border);
    background: var(--bg-input);
}

.bro-quick-btn:focus-visible {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 2px var(--accent-glow);
}

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

.bro-form input {
    flex: 1;
    min-width: 0;
    background: var(--bg-input);
    border: 1px solid var(--border);
    color: var(--text-primary);
    padding: 8px 12px;
    border-radius: var(--radius-xs);
    font-size: 0.88rem;
    font-family: inherit;
}

.bro-form button {
    background: var(--navy);
    color: var(--header-text);
    border: 1px solid var(--gold-border);
    border: none;
    padding: 8px 16px;
    border-radius: var(--radius-xs);
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    font-size: 0.85rem;
}

.bro-form button:hover:not(:disabled) {
    background: var(--navy-mid);
}

.bro-form button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.bro-disclaimer {
    font-size: 0.68rem;
    color: var(--text-muted);
    margin-top: 10px;
    line-height: 1.4;
    max-width: 720px;
}

.bro-disclaimer-sub {
    display: block;
    margin-top: 6px;
    opacity: 0.95;
}

.site-footer {
    max-width: 1664px;
    margin: 0 auto;
    padding: 16px 32px 32px;
    font-size: 0.75rem;
    color: var(--text-muted);
    border-top: 1px solid var(--border-subtle);
}

.site-footer a {
    color: var(--accent);
    text-decoration: none;
}

.site-footer a:hover {
    text-decoration: underline;
}

.site-footer-sep {
    margin: 0 8px;
    opacity: 0.5;
}

.site-footer-note {
    display: block;
    margin-top: 10px;
    max-width: 560px;
    line-height: 1.45;
}

.bro-msg.bro-loading div:last-child {
    opacity: 0.75;
    font-style: italic;
}

.bro-picks-title {
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    margin-bottom: 4px;
}

.bro-picks-hint {
    font-size: 0.72rem;
    color: var(--text-muted);
    margin-bottom: 10px;
}

.bro-top-picks {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.bro-pick-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-xs);
    padding: 10px 12px;
    font-size: 0.8rem;
}

.bro-pick-card a {
    color: var(--ticker-blue);
    font-weight: 600;
    text-decoration: none;
}

.bro-pick-card a:hover {
    text-decoration: underline;
}

.bro-pick-meta {
    color: var(--text-muted);
    font-size: 0.72rem;
    margin-top: 4px;
}

.bro-pick-ret {
    color: var(--green);
    font-size: 0.75rem;
    margin-top: 4px;
}

#clear-filters {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-muted);
    padding: 8px 14px;
    border-radius: var(--radius-xs);
    cursor: pointer;
    font-size: 0.8rem;
    font-weight: 500;
    transition: all var(--transition);
    font-family: inherit;
    align-self: flex-end;
}

#clear-filters:hover {
    border-color: var(--border-hover);
    color: var(--text-secondary);
    background: var(--bg-hover);
}

/* ---- Table ---- */

.table-container {
    overflow-x: auto;
    padding: 20px 32px 40px;
    max-width: 1664px;
    margin: 0 auto;
}

table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 0.84rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}

thead th {
    background: var(--bg-card);
    color: var(--text-muted);
    font-weight: 600;
    text-align: left;
    padding: 10px 14px;
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    white-space: nowrap;
    user-select: none;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    z-index: 10;
}

.col-expand {
    width: 36px;
    min-width: 36px;
    max-width: 36px;
}

th.numeric {
    text-align: right;
}

th.sortable {
    cursor: pointer;
    transition: all var(--transition);
}

th.sortable:hover {
    color: var(--navy-mid);
    background: var(--gold-faint);
}

th.sortable::after {
    content: "";
    margin-left: 4px;
    font-size: 0.6rem;
    opacity: 0.3;
}

th.active-sort { color: var(--accent); }
th.active-sort.asc::after { content: "\25B2"; color: var(--accent); opacity: 1; }
th.active-sort.desc::after { content: "\25BC"; color: var(--accent); opacity: 1; }

/* ---- Table Rows ---- */

tbody tr.fund-row {
    cursor: pointer;
    transition: background var(--transition);
}

tbody tr.fund-row:nth-child(4n+1) {
    background: rgba(15, 33, 55, 0.03);
}

tbody tr.fund-row:hover {
    background: var(--bg-hover);
}

tbody tr.fund-row.expanded {
    background: var(--accent-soft);
}

td {
    padding: 9px 14px;
    white-space: nowrap;
    border-bottom: 1px solid var(--border-subtle);
}

td.numeric {
    text-align: right;
    font-variant-numeric: tabular-nums;
    font-weight: 500;
}

/* ---- Expand Icon ---- */

.expand-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border-radius: var(--radius-xs);
    background: transparent;
    transition: all var(--transition);
    color: var(--text-muted);
}

.fund-row:hover .expand-icon {
    background: var(--gold-soft);
    color: var(--navy);
}

.fund-row.expanded .expand-icon {
    background: var(--navy);
    color: var(--header-text);
    transform: rotate(90deg);
}

/* ---- Detail Row ---- */

tr.detail-row {
    display: none;
}

tr.detail-row.open {
    display: table-row;
}

tr.detail-row td {
    padding: 0;
    border-bottom: 1px solid var(--border);
    background: var(--bg-detail);
}

.detail-panel {
    padding: 16px 20px 18px 50px;
    display: flex;
    gap: 32px;
    flex-wrap: wrap;
    animation: slideDown 0.2s ease;
}

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

.detail-item {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.detail-label {
    font-size: 0.65rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-weight: 600;
}

.detail-value {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary);
}

.detail-value.expense {
    color: var(--gold);
}

.detail-value.rating {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.rating-badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 10px;
    border-radius: 100px;
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.03em;
}

.rating-aaa {
    background: rgba(34, 197, 94, 0.12);
    color: var(--green);
    border: 1px solid rgba(34, 197, 94, 0.2);
}

.rating-aa {
    background: rgba(96, 165, 250, 0.12);
    color: var(--ticker-blue);
    border: 1px solid rgba(96, 165, 250, 0.2);
}

.rating-a {
    background: rgba(167, 139, 250, 0.12);
    color: var(--purple);
    border: 1px solid rgba(167, 139, 250, 0.2);
}

.rating-bbb {
    background: rgba(245, 158, 11, 0.12);
    color: var(--gold);
    border: 1px solid rgba(245, 158, 11, 0.2);
}

.rating-bb, .rating-b {
    background: var(--red-soft);
    color: var(--red);
    border: 1px solid rgba(239, 68, 68, 0.2);
}

.rating-nr {
    background: rgba(82, 82, 91, 0.2);
    color: var(--text-muted);
    border: 1px solid var(--border);
}

/* ---- Return colors ---- */

.positive { color: var(--green); }
.negative { color: var(--red); }
.na { color: var(--text-muted); font-size: 0.76rem; }

/* ---- Cell styling ---- */

.fund-name {
    max-width: 340px;
    overflow: hidden;
    text-overflow: ellipsis;
    font-weight: 500;
    color: var(--text-primary);
}

.ticker {
    color: var(--ticker-blue);
    font-weight: 600;
    font-family: "SF Mono", "Consolas", "JetBrains Mono", monospace;
    font-size: 0.78rem;
    letter-spacing: 0.02em;
}

.ticker-link {
    color: inherit;
    text-decoration: none;
    cursor: pointer;
    border-radius: 4px;
    padding: 2px 4px;
    margin: -2px -4px;
    transition: background var(--transition), color var(--transition);
}

.ticker-link:hover {
    color: var(--navy-mid);
    text-decoration: underline;
    background: var(--gold-soft);
}

.provider-cell {
    color: var(--purple);
    font-weight: 500;
}

.category-cell {
    color: var(--text-secondary);
    font-size: 0.8rem;
}

/* ---- Loading / Empty ---- */

.loading-state {
    text-align: center;
    padding: 60px 20px !important;
    color: var(--text-muted);
    font-size: 0.88rem;
}

.loading-state span {
    display: block;
    margin-top: 12px;
}

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

.empty-state {
    text-align: center;
    padding: 60px 20px !important;
    color: var(--text-muted);
    font-size: 0.88rem;
}

/* ---- Responsive ---- */

@media (max-width: 1024px) {
    header, .filters-bar {
        padding-left: 20px;
        padding-right: 20px;
    }
    .table-container {
        padding: 16px 20px 30px;
    }
    .search-group { max-width: 100%; }
}

@media (max-width: 768px) {
    .header-logo {
        height: 64px;
        max-width: 220px;
    }
    .header-content {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }
    .header-right {
        width: 100%;
        justify-content: space-between;
    }
    .filters-inner {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }
    .filter-group, .search-group {
        max-width: 100%;
    }
    select, input[type="text"] {
        min-width: 100%;
    }
    #clear-filters {
        align-self: stretch;
        justify-content: center;
    }
    header, .filters-bar {
        padding-left: 16px;
        padding-right: 16px;
    }
    .table-container {
        padding: 8px 8px 24px;
    }
    td, thead th {
        padding: 8px 10px;
    }
    .detail-panel {
        padding-left: 20px;
        gap: 20px;
    }
}

/* Infinite scroll sentinel */
.scroll-sentinel-cell {
    height: 1px;
    padding: 0 !important;
    border: none !important;
}
