:root {
    --ib-calc-bg-card: #1e293b;
    --ib-calc-bg-input: #0b1121;
    --ib-calc-border: #334155;
    --ib-calc-text-primary: #f8fafc;
    --ib-calc-text-secondary: #cbd5e1;
    --ib-calc-text-muted: #94a3b8;
    --ib-calc-cta-fg: #ffffff;
    --ib-calc-accent: #6366f1;
    --ib-calc-accent-hover: #818cf8;
    --ib-calc-radius-sm: 8px;
    --ib-calc-radius-md: 16px;
    --ib-calc-radius-xl: 24px;
    --ib-calc-ease: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    --ib-calc-shadow: 0 20px 40px -15px rgba(0, 0, 0, 0.5);
}

.profile-hero__ib-calculator {
    width: 100%;
    max-width: 480px;
}

.ib-calculator-card {
    background: var(--ib-calc-bg-card);
    border: 1px solid var(--ib-calc-border);
    border-radius: var(--ib-calc-radius-xl);
    padding: 28px;
    box-shadow: var(--ib-calc-shadow);
    display: flex;
    flex-direction: column;
    overflow: visible;
    position: relative;
}

.calc-display {
    background: var(--ib-calc-bg-input);
    border: 1px solid var(--ib-calc-border);
    border-radius: var(--ib-calc-radius-md);
    padding: 24px 20px;
    text-align: center;
    margin-bottom: 24px;
    box-shadow: inset 0 2px 10px rgba(0, 0, 0, 0.2);
}

.calc-display-label {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    color: var(--ib-calc-text-muted);
    margin-bottom: 12px;
}

h2.calc-display-label {
    margin-top: 0;
}

.calc-input-chip-wrap {
    position: relative;
    display: inline-flex;
    max-width: 100%;
    vertical-align: middle;
}

.calc-chip-tooltip {
    position: absolute;
    left: 50%;
    top: calc(100% + 6px);
    transform: translateX(-50%);
    z-index: 20;
    min-width: min(100vw - 48px, 14rem);
    max-width: min(100vw - 48px, 17.5rem);
    padding: var(--ib-calc-radius-sm) 10px;
    border-radius: var(--ib-calc-radius-sm);
    border: 1px solid var(--ib-calc-border);
    background: var(--ib-calc-bg-card);
    box-shadow: var(--ib-calc-shadow);
    font-size: 11px;
    font-weight: 500;
    line-height: 1.5;
    color: var(--ib-calc-text-secondary);
    text-align: left;
    text-transform: none;
    letter-spacing: normal;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.15s ease, visibility 0.15s ease;
}

.calc-input-chip-wrap:hover .calc-chip-tooltip,
.calc-input-chip-wrap:focus-within .calc-chip-tooltip,
.calc-input-chip-wrap.is-open .calc-chip-tooltip {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.calc-chip-tooltip__text {
    display: block;
}

.calc-input-chip--tooltip {
    cursor: pointer;
}

.calc-input-chip--tooltip:focus {
    outline: 2px solid var(--ib-calc-accent);
    outline-offset: 2px;
}

.calc-provenance-badge.calc-input-chip--tooltip:focus {
    outline-offset: 1px;
}

.calc-total-val {
    font-size: 48px;
    font-weight: 800;
    color: var(--ib-calc-text-primary);
    line-height: 1;
    letter-spacing: -0.02em;
}

.calc-total-val span {
    font-size: 18px;
    color: var(--ib-calc-text-muted);
    font-weight: 500;
    margin-left: 6px;
}

.calc-formula-display {
    font-size: 13px;
    color: var(--ib-calc-accent-hover);
    margin-top: 16px;
    font-family: "SFMono-Regular", Consolas, monospace;
    min-height: 20px;
    opacity: 0.9;
}

.calc-tabs {
    display: flex;
    background: var(--ib-calc-bg-input);
    border: 1px solid var(--ib-calc-border);
    border-radius: var(--ib-calc-radius-sm);
    padding: 4px;
    position: relative;
    margin-bottom: 24px;
}

.calc-tab {
    flex: 1;
    text-align: center;
    padding: 10px 4px;
    font-size: 13px;
    font-weight: 600;
    color: var(--ib-calc-text-muted);
    cursor: pointer;
    border-radius: 6px;
    z-index: 2;
    transition: var(--ib-calc-ease);
    position: relative;
}

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

.calc-tab.active {
    color: var(--ib-calc-text-primary);
}

.tab-indicator {
    position: absolute;
    top: 4px;
    bottom: 4px;
    background: var(--ib-calc-border);
    border-radius: 6px;
    transition: var(--ib-calc-ease);
    z-index: 1;
}

.calc-sliders-container {
    display: flex;
    flex-direction: column;
}

.slider-group-view {
    display: none;
    flex-direction: column;
    gap: 24px;
}

.slider-group-view.active {
    display: flex;
    animation: calcFadeIn 0.3s ease-out forwards;
}

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

.calc-group {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.calc-label-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.calc-label-row label {
    font-size: 13px;
    font-weight: 500;
    color: var(--ib-calc-text-secondary);
    display: flex;
    align-items: center;
    gap: 8px;
    line-height: 1.2;
}

.calc-label-row--stacked {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
    margin-bottom: -10px;
}

.calc-label-row--tight-to-slider {
    margin-bottom: -10px;
}

.calc-provenance-badge {
    display: inline-flex;
    align-items: center;
    flex-shrink: 0;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.calc-provenance-badge--listing {
    background: rgba(16, 185, 129, 0.15);
    color: #34d399;
    border: 1px solid rgba(16, 185, 129, 0.35);
}

.calc-provenance-badge--modeled {
    background: rgba(99, 102, 241, 0.12);
    color: var(--ib-calc-accent-hover);
    border: 1px solid rgba(99, 102, 241, 0.35);
}

.calc-provenance-badge--you {
    background: rgba(148, 163, 184, 0.12);
    color: var(--ib-calc-text-secondary);
    border: 1px solid var(--ib-calc-border);
}

.calc-provenance-badge--illustrative {
    background: rgba(245, 158, 11, 0.15);
    color: #fbbf24;
    border: 1px solid rgba(245, 158, 11, 0.4);
}

.calc-input-chip {
    display: inline-flex;
    align-items: center;
    flex-shrink: 0;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    border: 1px dashed var(--ib-calc-border);
    color: var(--ib-calc-text-muted);
}

.calc-input-chip--you {
    border-color: rgba(99, 102, 241, 0.35);
    color: var(--ib-calc-accent-hover);
}

.calc-tier-meta--with-badge {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 10px;
    justify-content: flex-end;
    text-align: right;
    max-width: min(100%, 14rem);
}

.calc-tier-meta__active {
    font-size: 12px;
    color: var(--ib-calc-text-muted);
    font-weight: 500;
}

.calc-hybrid-note {
    margin: 10px 0 0;
    font-size: 11px;
    line-height: 1.5;
    color: var(--ib-calc-text-muted);
}

.calc-how-wrap {
    display: flex;
    flex-direction: column;
    gap: 0;
    margin-bottom: 20px;
}

.calc-how-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    width: 100%;
    padding: 10px 12px;
    margin: 0;
    font-family: inherit;
    font-size: 12px;
    font-weight: 600;
    color: var(--ib-calc-text-secondary);
    background: var(--ib-calc-bg-input);
    border: 1px solid var(--ib-calc-border);
    border-radius: var(--ib-calc-radius-sm);
    cursor: pointer;
    transition: var(--ib-calc-ease);
    text-align: left;
}

.calc-how-toggle:hover {
    color: var(--ib-calc-text-primary);
    border-color: rgba(99, 102, 241, 0.35);
}

.calc-how-toggle__icon {
    font-size: 10px;
    transition: transform 0.2s ease;
}

.calc-how-wrap.is-open .calc-how-toggle__icon {
    transform: rotate(180deg);
}

.calc-how-panel {
    margin: 8px 0 0;
    padding: 12px;
    border-radius: var(--ib-calc-radius-sm);
    border: 1px solid var(--ib-calc-border);
    background: rgba(99, 102, 241, 0.05);
}

.calc-how-list {
    margin: 0;
    padding-left: 1.1rem;
    display: flex;
    flex-direction: column;
    gap: 10px;
    font-size: 11px;
    line-height: 1.5;
    color: var(--ib-calc-text-secondary);
}

.calc-how-list strong {
    color: var(--ib-calc-text-primary);
    font-weight: 700;
}

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

.calc-tier-meta {
    font-size: 12px;
    color: var(--ib-calc-text-muted);
    font-weight: 500;
}

.slider-wrapper {
    padding: 8px 0;
}

.slider-wrapper--bubbled {
    padding: 8px 0 32px;
    position: relative;
}

.profile-hero__ib-calculator input[type="range"] {
    -webkit-appearance: none;
    width: 100%;
    height: 6px;
    background: var(--ib-calc-bg-input);
    border-radius: 4px;
    outline: none;
    background-image: linear-gradient(var(--ib-calc-accent), var(--ib-calc-accent));
    background-repeat: no-repeat;
    cursor: pointer;
}

.profile-hero__ib-calculator input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    height: 20px;
    width: 20px;
    border-radius: 50%;
    background: #fff;
    cursor: pointer;
    border: 3px solid var(--ib-calc-accent);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
    transition: transform 0.1s;
}

.profile-hero__ib-calculator input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.15);
}

.slider-bubble {
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    background: var(--ib-calc-accent);
    color: #fff;
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 600;
    pointer-events: none;
    transition: left 0.1s linear;
    white-space: nowrap;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.slider-bubble::after {
    content: "";
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 4px solid transparent;
    border-bottom-color: var(--ib-calc-accent);
}

.calc-top-controls {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 8px;
    padding-bottom: 20px;
    border-bottom: 1px dashed var(--ib-calc-border);
}

.calc-top-controls__cell {
    min-width: 0;
}

.calc-account-label {
    font-size: 13px;
    font-weight: 500;
    color: var(--ib-calc-text-secondary);
    line-height: 1.2;
}

.calc-account-switch {
    width: 100%;
}

.calc-account-switch__content {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    margin-top: 10px;
    background: var(--ib-calc-bg-input);
    border: 1px solid var(--ib-calc-border);
    border-radius: var(--ib-calc-radius-sm);
    padding: 4px;
    width: 100%;
}

.calc-account-switch__label {
    flex: 1;
    text-align: center;
    padding: 6px 0;
    font-size: 12px;
    font-weight: 500;
    color: var(--ib-calc-text-muted);
    cursor: pointer;
    transition: var(--ib-calc-ease);
    user-select: none;
    border-radius: 6px;
}

.calc-account-switch__label.is-active {
    background: var(--ib-calc-border);
    color: var(--ib-calc-text-primary);
    font-weight: 600;
}

.calc-account-switch__control {
    display: none;
}

#forexIbCalc_row_ecn {
    display: none;
}

.calc-info-panel {
    background: rgba(99, 102, 241, 0.05);
    border: 1px solid rgba(99, 102, 241, 0.1);
    border-radius: var(--ib-calc-radius-sm);
    padding: 12px;
    margin-top: 4px;
}

.calc-subtext {
    font-size: 12px;
    color: var(--ib-calc-text-secondary);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.tier-notation {
    color: var(--ib-calc-accent-hover);
    font-weight: 600;
}

.sub-ib-section {
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px dashed var(--ib-calc-border);
}

.sub-ib-title {
    color: var(--ib-calc-text-primary);
    font-weight: 600;
}

.sub-ib-title i {
    color: var(--ib-calc-accent);
}

.toggle-switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--ib-calc-bg-input);
    border: 1px solid var(--ib-calc-border);
    transition: 0.4s;
    border-radius: 24px;
}

.toggle-slider::before {
    position: absolute;
    content: "";
    height: 16px;
    width: 16px;
    left: 3px;
    bottom: 3px;
    background-color: var(--ib-calc-text-muted);
    transition: 0.4s;
    border-radius: 50%;
}

.toggle-switch input:checked + .toggle-slider {
    background-color: var(--ib-calc-accent);
    border-color: var(--ib-calc-accent);
}

.toggle-switch input:checked + .toggle-slider::before {
    transform: translateX(20px);
    background-color: #fff;
}

.sub-ib-wrapper {
    display: grid;
    grid-template-rows: 0fr;
    transition: grid-template-rows 0.35s cubic-bezier(0.4, 0, 0.2, 1), margin-top 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    margin-top: 0;
}

.sub-ib-wrapper.active {
    grid-template-rows: 1fr;
    margin-top: 20px;
}

.sub-ib-panel {
    min-height: 0;
    overflow: hidden;
    border: 1px solid transparent;
    border-radius: var(--ib-calc-radius-sm);
    background: rgba(255, 255, 255, 0.02);
    transition: border-color 0.35s ease;
}

.sub-ib-wrapper.active .sub-ib-panel {
    border-color: var(--ib-calc-border);
}

.sub-ib-panel-inner {
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

#forexIbCalc_sub_cpa_group {
    display: none;
}

.cta-btn {
    background: var(--ib-calc-accent);
    color: var(--ib-calc-cta-fg);
    border: none;
    border-radius: var(--ib-calc-radius-sm);
    padding: 18px;
    font-size: 16px;
    font-weight: 600;
    text-align: center;
    cursor: pointer;
    transition: var(--ib-calc-ease);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    text-decoration: none;
    width: 100%;
    margin-top: 28px;
}

.profile-hero__ib-calculator a.cta-btn,
.profile-hero__ib-calculator a.cta-btn:visited,
.profile-hero__ib-calculator a.cta-btn:hover {
    color: var(--ib-calc-cta-fg);
}

.cta-btn:hover {
    background: var(--ib-calc-accent-hover);
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(99, 102, 241, 0.25);
}

.cta-btn.is-disabled {
    opacity: 0.65;
    cursor: not-allowed;
    pointer-events: none;
}

@media (max-width: 560px) {
    .ib-calculator-card {
        padding: 20px;
    }

    .calc-total-val {
        font-size: 38px;
    }
}
