.funnel-card {
    background: rgba(0, 0, 0, 0.22);
    border: 1px solid var(--border-light, rgba(255, 255, 255, 0.1));
    border-radius: 14px;
    padding: 1.5rem;
    margin-top: 1rem;
    position: relative;
    overflow: visible;
}

.funnel-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.funnel-title h3 {
    font-family: 'Source Serif 4', Georgia, serif;
    font-size: 1.375rem;
    font-weight: 500;
    color: #fff;
    margin: 0 0 0.25rem;
}

.funnel-title p {
    color: var(--text-light, rgba(255, 255, 255, 0.72));
    font-size: 0.875rem;
    margin: 0;
}

.funnel-view-toggles {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.fv-group {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    padding: 3px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 10px;
}

.fv-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 28px;
    padding: 0;
    background: transparent;
    border: none;
    border-radius: 7px;
    color: rgba(255, 255, 255, 0.5);
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease, opacity 0.15s ease;
    font-size: 14px;
    line-height: 1;
}

.fv-btn:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.06);
}

.fv-btn.is-active {
    background: rgba(255, 255, 255, 0.13);
    color: #fff;
    box-shadow: 0 1px 0 rgba(255, 255, 255, 0.07) inset, 0 1px 2px rgba(0, 0, 0, 0.25);
}

.fv-btn.fv-emoji {
    font-size: 16px;
    opacity: 0.55;
}

.fv-btn.fv-emoji.is-active {
    opacity: 1;
}

.fv-btn svg {
    width: 16px;
    height: 16px;
    display: block;
}

.funnel-filters {
    display: grid;
    grid-template-columns: repeat(2, minmax(220px, 300px)) auto;
    align-items: end;
    justify-content: start;
    gap: 0.8rem;
    margin: 1rem 0 1.4rem;
    padding: 1rem;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 10px;
}

.funnel-filters .filter-row {
    display: grid;
    gap: 0.45rem;
    min-width: 0;
    width: 100%;
}

.funnel-filters .filter-label {
    min-width: 0;
    color: var(--text-lighter, rgba(255, 255, 255, 0.48));
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    font-weight: 700;
}

.sf-select-wrap {
    display: block;
    position: relative;
}

.sf-select-wrap::after {
    content: "";
    position: absolute;
    right: 0.9rem;
    top: 50%;
    width: 0.48rem;
    height: 0.48rem;
    border-right: 1.8px solid currentColor;
    border-bottom: 1.8px solid currentColor;
    color: rgba(255, 255, 255, 0.66);
    pointer-events: none;
    transform: translateY(-68%) rotate(45deg);
}

.sf-select-sr {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.sf-select {
    width: 100%;
    min-height: 42px;
    appearance: none;
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 9px;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.045)),
        rgba(255, 255, 255, 0.04);
    color: #fff;
    font: 700 0.85rem 'DM Sans', sans-serif;
    padding: 0.58rem 2.3rem 0.58rem 0.85rem;
    cursor: pointer;
    box-shadow: 0 1px 0 rgba(255, 255, 255, 0.05) inset;
}

.sf-select:hover,
.sf-select:focus {
    border-color: rgba(242, 165, 94, 0.45);
    outline: none;
    box-shadow: 0 0 0 3px rgba(242, 165, 94, 0.14);
}

.sf-select:disabled {
    cursor: default;
    opacity: 0.82;
}

.sf-select-wrap.is-single-option::after {
    opacity: 0.48;
}

.sf-select option {
    color: #101828;
}

.funnel-reset-row {
    display: flex;
    justify-content: flex-start;
    align-self: end;
    margin-top: 0;
}

.funnel-reset {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    min-height: 42px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.12);
    color: var(--text-light, rgba(255, 255, 255, 0.72));
    border-radius: 999px;
    padding: 0.42rem 0.9rem;
    font: 600 0.75rem 'DM Sans', sans-serif;
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.funnel-reset[hidden] {
    display: none;
}

.funnel-reset:hover {
    color: #fff;
    background: rgba(242, 165, 94, 0.14);
    border-color: rgba(242, 165, 94, 0.45);
}

.funnel-reset svg {
    width: 12px;
    height: 12px;
}

.funnel-pool {
    text-align: center;
    margin: 0.35rem 0 1.15rem;
    padding: 0.65rem 1rem 0.35rem;
}

.funnel-pool-value {
    font-size: 1.75rem;
    font-weight: 800;
    color: #5BD89F;
    display: inline-block;
    margin-right: 0.5rem;
    vertical-align: baseline;
    font-variant-numeric: tabular-nums;
    line-height: 1.1;
}

.funnel-pool-label {
    display: inline-block;
    color: #fff;
    font-size: 1.75rem;
    font-weight: 800;
    vertical-align: baseline;
    line-height: 1.1;
}

.funnel-pool-sub {
    color: var(--text-lighter, rgba(255, 255, 255, 0.48));
    font-size: 0.8125rem;
    font-weight: 700;
    margin-top: 0.45rem;
}

.funnel-stages {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    position: relative;
    padding: 0;
}

.funnel-empty {
    padding: 2rem;
    text-align: center;
    color: var(--text-lighter, rgba(255, 255, 255, 0.48));
}

.funnel-sections {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    position: relative;
}

.funnel-sections::before {
    content: "";
    position: absolute;
    top: 0;
    bottom: 0;
    left: calc(50% + 3.6rem);
    width: 1px;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.18), rgba(255, 255, 255, 0.06));
    pointer-events: none;
}

.funnel-section {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 0.55rem 0.85rem 0.55rem 8rem;
    border: 1px solid var(--section-border);
    border-radius: 8px;
    background: var(--section-bg);
    min-height: 0;
}

.funnel-section-label {
    position: absolute;
    left: 0.9rem;
    top: 0.8rem;
    width: 6.4rem;
    color: rgba(255, 255, 255, 0.34);
    font-size: 0.9rem;
    font-weight: 400;
    line-height: 1.1;
    text-transform: uppercase;
    letter-spacing: 0.035em;
}

.funnel-section-total {
    display: inline-block;
    margin-right: 0.35rem;
    color: var(--section-text);
    font-weight: 500;
}

.funnel-row {
    position: relative;
    display: flex;
    align-items: center;
    margin-left: var(--indent, 0%);
    margin-right: var(--indent, 0%);
}

.funnel-bar {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.85rem;
    width: 100%;
    padding: 0.62rem 0.85rem;
    border-radius: 7px;
    border: 1px solid var(--stage-border);
    background: var(--stage-bg);
    min-height: 48px;
    box-shadow: 0 1px 0 rgba(255, 255, 255, 0.04) inset, 0 0 18px -12px var(--section-text);
    flex-shrink: 0;
    overflow: hidden;
}

.funnel-bar.has-company-tooltip {
    cursor: help;
}

.funnel-bar.has-company-tooltip:focus {
    outline: 2px solid rgba(242, 165, 94, 0.75);
    outline-offset: 2px;
}

.funnel-bar-main {
    display: flex;
    align-items: center;
    gap: 0.72rem;
    min-width: 0;
    flex: 1;
}

.funnel-bar .fs-count {
    font-size: 1.28rem;
    font-weight: 800;
    color: var(--section-text);
    font-variant-numeric: tabular-nums;
    flex-shrink: 0;
    line-height: 1.1;
    min-width: 3.35rem;
    text-align: left;
}

.funnel-bar .fs-meta {
    min-width: 0;
}

.funnel-bar .fs-meta strong {
    display: block;
    font-weight: 800;
    font-size: 0.86rem;
    color: #fff;
    line-height: 1.18;
}

.funnel-bar .fs-meta small {
    display: block;
    font-size: 0.72rem;
    color: rgba(255, 255, 255, 0.62);
    line-height: 1.2;
    margin-top: 0.12rem;
}

.funnel-convs {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 4px;
    flex-shrink: 0;
}

.fs-conv {
    display: inline-flex;
    align-items: center;
    gap: 0.48rem;
    background: rgba(255, 255, 255, 0.10);
    border: 1px solid rgba(255, 255, 255, 0.13);
    border-radius: 5px;
    padding: 0.22rem 0.58rem;
    font-size: 0.68rem;
    color: rgba(255, 255, 255, 0.58);
    font-weight: 700;
    white-space: nowrap;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

.fs-conv strong {
    color: #fff;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

/* Teaser stages — round counts we don't expose per entity (e.g. university
   alumni funnels). The bar + label stay crisp so the funnel reads identically
   to a full one; only the numbers are blurred to gate them behind a demo. */
.funnel-bar.is-teaser .fs-count { filter: blur(6px); -webkit-user-select: none; user-select: none; cursor: default; }
.funnel-bar.is-teaser .funnel-convs { filter: blur(4px); -webkit-user-select: none; user-select: none; }

.funnel-outcomes {
    margin-top: 1.25rem;
    padding-top: 1rem;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.funnel-outcome-row {
    display: flex;
    gap: 0.4rem;
    align-items: baseline;
    font-size: 0.8125rem;
    color: var(--text-light, rgba(255, 255, 255, 0.72));
    justify-content: center;
    flex-wrap: wrap;
}

.funnel-outcome-row .fo-label {
    color: var(--stage-color, #fff);
    font-weight: 700;
}

.funnel-outcome-row .fo-names {
    color: rgba(255, 255, 255, 0.7);
}

.funnel-card[data-layout="horizontal"] .funnel-stages {
    overflow: visible;
    padding-bottom: 0.45rem;
}

.funnel-card[data-layout="horizontal"] .funnel-outcomes {
    display: none;
}

.funnel-card[data-layout="horizontal"] .funnel-sections {
    width: 100%;
    min-width: 0;
    display: flex;
    flex-direction: row;
    align-items: stretch;
    gap: 0.28rem;
}

.funnel-card[data-layout="horizontal"] .funnel-sections::before {
    display: none;
}

.funnel-card[data-layout="horizontal"] .funnel-section {
    flex-direction: column;
    gap: 0.35rem;
    padding: 3.6rem 0.42rem 0.7rem;
    flex: var(--section-span, 1) var(--section-span, 1) 0;
    min-width: 0;
    overflow: visible;
}

.funnel-card[data-layout="horizontal"] .funnel-section-label {
    left: 0.7rem;
    right: 0.7rem;
    top: 0.75rem;
    width: auto;
    font-size: 0.91rem;
    letter-spacing: 0.035em;
    white-space: nowrap;
}

.funnel-card[data-layout="horizontal"] .funnel-section-stages {
    display: flex;
    flex-direction: row;
    align-items: flex-start;
    gap: 0.28rem;
    height: 100%;
}

.funnel-card[data-layout="horizontal"] .funnel-row {
    flex: 1 1 0;
    min-width: 0;
    margin: 0;
    flex-direction: column;
    align-items: stretch;
}

.funnel-card[data-layout="horizontal"] .funnel-bar {
    flex-direction: column;
    align-items: center;
    text-align: center;
    width: 100%;
    min-height: var(--stage-height, 160px);
    padding: 0.85rem 0.42rem 0.72rem;
    gap: 0.55rem;
    justify-content: space-between;
}

.funnel-card[data-layout="horizontal"] .funnel-bar-main {
    flex-direction: column;
    justify-content: flex-start;
    gap: 0.45rem;
    flex: 0 0 auto;
}

.funnel-card[data-layout="horizontal"] .funnel-bar .fs-count {
    text-align: center;
    min-width: 0;
    font-size: clamp(0.78rem, 0.95vw, 1.02rem);
}

.funnel-card[data-layout="horizontal"] .funnel-bar .fs-meta {
    text-align: center;
}

.funnel-card[data-layout="horizontal"] .funnel-bar .fs-meta strong {
    font-size: clamp(0.58rem, 0.73vw, 0.78rem);
    overflow-wrap: anywhere;
}

.funnel-card[data-layout="horizontal"] .funnel-bar .fs-meta small {
    font-size: clamp(0.52rem, 0.62vw, 0.68rem);
    overflow-wrap: anywhere;
}

.funnel-card[data-layout="horizontal"] .funnel-convs {
    flex-direction: column;
    align-items: stretch;
    gap: 3px;
    margin-top: auto;
    width: min(100%, 4.4rem);
}

.funnel-card[data-layout="horizontal"] .fs-conv {
    display: block;
    justify-content: center;
    text-align: center;
    padding: 0.34rem 0.28rem;
    white-space: normal;
    line-height: 1.2;
    font-size: clamp(0.5rem, 0.57vw, 0.68rem);
}

.funnel-card[data-layout="horizontal"] .fs-conv strong {
    display: block;
    font-size: clamp(0.66rem, 0.74vw, 0.85rem);
    margin-top: 0.18rem;
}

.funnel-company-list {
    display: none;
    margin-top: 0.78rem;
    max-height: 162px;
    overflow: hidden;
    color: rgba(255, 255, 255, 0.36);
    font-size: 0.82rem;
    line-height: 1.55;
    text-align: left;
}

.funnel-company-list div {
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.funnel-card[data-layout="horizontal"] .funnel-company-list {
    display: none;
}

.funnel-tooltip {
    position: fixed;
    z-index: 3000;
    width: min(360px, calc(100vw - 2rem));
    max-height: min(320px, calc(100vh - 2rem));
    overflow: auto;
    padding: 0.9rem;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.14);
    background: rgba(12, 18, 32, 0.96);
    color: #fff;
    box-shadow: 0 20px 56px rgba(0, 0, 0, 0.36);
    pointer-events: none;
    opacity: 0;
    transform: translate(-50%, -100%) translateY(-8px);
    transition: opacity 0.12s ease, transform 0.12s ease;
}

.funnel-tooltip.is-visible {
    opacity: 1;
    transform: translate(-50%, -100%);
}

.funnel-tooltip[data-placement="bottom"] {
    transform: translate(-50%, 8px);
}

.funnel-tooltip[data-placement="bottom"].is-visible {
    transform: translate(-50%, 0);
}

.sft-title {
    font-weight: 800;
    font-size: 0.82rem;
    margin-bottom: 0.55rem;
}

.sft-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
}

.sft-list span {
    display: inline-flex;
    align-items: center;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.07);
    padding: 0.18rem 0.48rem;
    color: rgba(255, 255, 255, 0.82);
    font-size: 0.76rem;
    line-height: 1.25;
}

.sft-more {
    margin-top: 0.55rem;
    color: rgba(255, 255, 255, 0.58);
    font-size: 0.76rem;
    font-weight: 700;
}

html[data-theme="light"] .funnel-card {
    background: #fff;
    border-color: rgba(16, 24, 40, 0.10);
    box-shadow: 0 18px 44px rgba(16, 24, 40, 0.10);
    color: #101828;
}

html[data-theme="light"] .funnel-title h3,
html[data-theme="light"] .funnel-bar .fs-meta strong,
html[data-theme="light"] .funnel-pool-label,
html[data-theme="light"] .fs-conv strong {
    color: #101828;
}

html[data-theme="light"] .funnel-title p,
html[data-theme="light"] .funnel-pool-sub,
html[data-theme="light"] .funnel-bar .fs-meta small,
html[data-theme="light"] .funnel-outcome-row,
html[data-theme="light"] .funnel-outcome-row .fo-names {
    color: rgba(16, 24, 40, 0.62);
}

html[data-theme="light"] .funnel-filters {
    background: #F8FAFC;
    border-color: rgba(16, 24, 40, 0.08);
}

html[data-theme="light"] .funnel-section-label {
    color: rgba(16, 24, 40, 0.58);
}

html[data-theme="light"] .sf-select {
    color: #344054;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(248, 250, 252, 0.96)),
        #fff;
    border-color: rgba(16, 24, 40, 0.12);
    box-shadow: 0 1px 2px rgba(16, 24, 40, 0.05);
}

html[data-theme="light"] .sf-select-wrap::after {
    color: rgba(16, 24, 40, 0.58);
}

html[data-theme="light"] .funnel-reset {
    background: #fff;
    border-color: rgba(16, 24, 40, 0.12);
    color: rgba(16, 24, 40, 0.66);
}

html[data-theme="light"] .funnel-reset:hover {
    color: #101828;
    background: #FFF7ED;
    border-color: rgba(234, 88, 12, 0.28);
}

html[data-theme="light"] .fs-conv {
    background: rgba(255, 255, 255, 0.76);
    border-color: rgba(16, 24, 40, 0.10);
    color: rgba(16, 24, 40, 0.56);
}

html[data-theme="light"] .funnel-tooltip {
    background: rgba(255, 255, 255, 0.98);
    color: #101828;
    border-color: rgba(16, 24, 40, 0.12);
    box-shadow: 0 20px 56px rgba(16, 24, 40, 0.16);
}

html[data-theme="light"] .sft-list span {
    background: #F8FAFC;
    border-color: rgba(16, 24, 40, 0.10);
    color: rgba(16, 24, 40, 0.74);
}

html[data-theme="light"] .sft-more {
    color: rgba(16, 24, 40, 0.56);
}

@media (max-width: 720px) {
    .funnel-card {
        padding: 1rem 0.85rem 1.1rem;
    }

    .funnel-head {
        gap: 0.5rem;
    }

    .funnel-filters {
        grid-template-columns: 1fr;
    }

    .funnel-pool {
        padding: 0.4rem 0 0.7rem;
    }

    .funnel-pool-value {
        display: block;
        margin-right: 0;
        margin-bottom: 0.25rem;
        font-size: 1.2rem;
    }

    .funnel-pool-label {
        display: block;
        font-size: 1.2rem;
    }

    .funnel-pool-sub {
        font-size: 0.74rem;
    }

    .funnel-card[data-layout="horizontal"] .funnel-sections,
    .funnel-sections {
        flex-direction: column;
        gap: 0.9rem;
    }

    .funnel-card[data-layout="horizontal"] .funnel-section,
    .funnel-section {
        min-width: 0;
        padding: 0.7rem 0.65rem;
        border-radius: 8px;
        flex: 0 0 auto;
        overflow: visible;
    }

    .funnel-card[data-layout="horizontal"] .funnel-section-label,
    .funnel-section-label {
        position: static;
        width: auto;
        left: auto;
        right: auto;
        top: auto;
        font-size: 0.68rem;
        letter-spacing: 0.08em;
        white-space: normal;
        margin-bottom: 0.2rem;
    }

    .funnel-card[data-layout="horizontal"] .funnel-section-stages {
        flex-direction: column;
        gap: 0.18rem;
        height: auto;
        align-items: stretch;
    }

    .funnel-card[data-layout="horizontal"] .funnel-row,
    .funnel-row {
        flex: 0 0 auto;
        margin: 0;
        flex-direction: row;
        align-items: center;
    }

    .funnel-card[data-layout="horizontal"] .funnel-bar,
    .funnel-bar {
        min-height: 0;
        flex-direction: row;
        gap: 0.5rem;
        padding: 0.5rem 0.6rem;
        justify-content: flex-start;
    }

    .funnel-card[data-layout="horizontal"] .funnel-bar-main {
        gap: 0.65rem;
        flex-direction: row;
        align-items: baseline;
    }

    .funnel-bar .fs-count {
        font-size: 1rem;
        min-width: 3.4rem;
    }

    .funnel-bar .fs-meta strong {
        font-size: 0.82rem;
    }

    .funnel-bar .fs-meta small,
    .funnel-convs {
        display: none;
    }
}
