.hedge-calculator {
    display: grid;
    gap: var(--al-space-8, 32px);
    margin: var(--al-space-8, 32px) 0;
    padding: clamp(24px, 4vw, 40px);
    border: 1px solid rgba(15, 23, 42, 0.1);
    border-radius: var(--al-radius-xl, 20px);
    background: var(--al-surface, #fff);
    box-shadow: var(--al-shadow-sm, 0 4px 12px rgba(15, 23, 42, 0.06));
    color: var(--al-text, #0f172a);
}

.hedge-calculator__header {
    max-width: var(--al-content-max, 760px);
}

.hedge-calculator__header h2 {
    margin: var(--al-space-2, 8px) 0;
    color: var(--al-text, #0f172a);
}

.hedge-calculator__header p,
.hedge-calculator__choice-hint,
.hedge-calculator__objective-copy,
.hedge-calculator__disclaimer {
    color: var(--al-muted, #64748b);
}

.hedge-calculator__form {
    display: grid;
    gap: var(--al-space-6, 24px);
}

.hedge-calculator__settings {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr);
    gap: var(--al-space-6, 24px);
}

.hedge-calculator__choice {
    min-width: 0;
    margin: 0;
    padding: 0;
    border: 0;
}

.hedge-calculator__choice legend,
.hedge-calculator__field > span:first-child {
    padding: 0;
    color: var(--al-text, #0f172a);
    font-size: var(--al-text-md, 16px);
    font-weight: 750;
    line-height: 1.35;
}

.hedge-calculator__choice-hint,
.hedge-calculator__objective-copy {
    margin: var(--al-space-1, 4px) 0 0;
    min-height: 2.9em;
    font-size: var(--al-text-sm, 14px);
    line-height: 1.45;
}

.hedge-calculator__segments {
    display: grid;
    margin-top: var(--al-space-3, 12px);
}

.hedge-calculator__segments--market {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.hedge-calculator__segments--objective {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.hedge-calculator__segments label {
    position: relative;
    min-width: 0;
    margin: 0;
    cursor: pointer;
}

.hedge-calculator__segments input {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
    pointer-events: none;
}

.hedge-calculator__segments label > span {
    position: relative;
    z-index: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 52px;
    margin-left: -1px;
    padding: var(--al-space-3, 12px);
    border: 1px solid rgba(15, 23, 42, 0.2);
    background: var(--al-surface, #fff);
    color: var(--al-text, #0f172a);
    font-size: var(--al-text-sm, 14px);
    font-weight: 750;
    line-height: 1.2;
    text-align: center;
    transition: border-color 0.16s ease, background-color 0.16s ease, color 0.16s ease, box-shadow 0.16s ease;
}

.hedge-calculator__segments label:first-child > span {
    margin-left: 0;
    border-radius: var(--al-radius-md, 12px) 0 0 var(--al-radius-md, 12px);
}

.hedge-calculator__segments label:last-child > span {
    border-radius: 0 var(--al-radius-md, 12px) var(--al-radius-md, 12px) 0;
}

.hedge-calculator__segments input:checked + span {
    z-index: 1;
    border-color: var(--al-primary, #2563eb);
    color: var(--al-primary-strong, #1d4ed8);
    box-shadow: inset 0 0 0 1px var(--al-primary, #2563eb);
}

.hedge-calculator__segments--market input:checked + span {
    background: var(--al-primary, #2563eb);
    color: #fff;
    box-shadow: none;
}

.hedge-calculator__segments input:focus-visible + span {
    z-index: 2;
    outline: 3px solid rgba(37, 99, 235, 0.28);
    outline-offset: 3px;
}

.hedge-calculator__segments label:hover > span {
    border-color: rgba(37, 99, 235, 0.52);
}

.hedge-calculator__fields {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: var(--al-space-4, 16px);
}

.hedge-calculator__field {
    display: flex;
    flex-direction: column;
    gap: var(--al-space-1, 4px);
    min-width: 0;
    margin: 0;
}

.hedge-calculator__field[hidden],
.hedge-calculator [hidden] {
    display: none !important;
}

.hedge-calculator__field small {
    min-height: 2.6em;
    color: var(--al-muted, #64748b);
    font-size: var(--al-text-sm, 14px);
    font-weight: 500;
    line-height: 1.3;
}

.hedge-calculator__input-wrap {
    display: flex;
    align-items: center;
    min-height: 52px;
    margin-top: var(--al-space-2, 8px);
    overflow: hidden;
    border: 1px solid rgba(15, 23, 42, 0.2);
    border-radius: var(--al-radius-md, 12px);
    background: var(--al-surface, #fff);
    color: var(--al-text, #0f172a);
}

.hedge-calculator__input-wrap > span {
    align-self: stretch;
    display: flex;
    align-items: center;
    padding: 0 var(--al-space-3, 12px);
    border-right: 1px solid rgba(15, 23, 42, 0.12);
    background: var(--al-page, #f8fafc);
    color: var(--al-muted, #64748b);
    font-weight: 700;
}

.hedge-calculator__input-wrap input + span {
    border-right: 0;
    border-left: 1px solid rgba(15, 23, 42, 0.12);
}

.hedge-calculator__input-wrap input {
    width: 100%;
    min-width: 0;
    min-height: 50px;
    padding: 0 var(--al-space-3, 12px);
    border: 0;
    border-radius: 0;
    background: transparent;
    color: var(--al-text, #0f172a);
    font: inherit;
    font-weight: 650;
}

.hedge-calculator__input-wrap:focus-within {
    border-color: var(--al-primary, #2563eb);
    outline: 0;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.18);
}

.hedge-calculator__input-wrap input:focus {
    outline: 0;
}

.hedge-calculator__coverage-note {
    display: flex;
    align-items: flex-start;
    gap: var(--al-space-2, 8px);
    margin: 0;
    color: var(--al-muted, #64748b);
    font-size: var(--al-text-sm, 14px);
    line-height: 1.5;
}

.hedge-calculator__coverage-icon {
    flex: 0 0 20px;
    width: 20px;
    height: 20px;
    margin-top: 1px;
    color: var(--al-primary, #2563eb);
}

.hedge-calculator__coverage-icon svg {
    display: block;
    width: 100%;
    height: 100%;
}

.hedge-calculator__error {
    margin: 0;
    padding: var(--al-space-3, 12px);
    border: 1px solid rgba(185, 28, 28, 0.25);
    border-radius: var(--al-radius-sm, 8px);
    background: rgba(254, 226, 226, 0.72);
    color: #991b1b;
    font-weight: 650;
}

.hedge-calculator__submit {
    width: 100%;
    min-height: 56px;
    justify-content: center;
}

.hedge-calculator__results {
    scroll-margin-top: calc(var(--al-mega-height, 68px) + 2.5rem);
    display: grid;
    gap: var(--al-space-7, 28px);
}

.hedge-calculator__results:focus-visible {
    outline: 0;
}

.hedge-calculator__results:focus-visible .hedge-calculator__protection {
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.2);
}

.hedge-calculator__protection {
    padding: clamp(20px, 4vw, 28px);
    border: 1px solid rgba(22, 101, 52, 0.12);
    border-radius: var(--al-radius-lg, 16px);
    background: var(--al-success-soft, #eaf3e8);
    transition: box-shadow 0.16s ease;
}

.hedge-calculator__protection[data-hedge-status="breakeven"] {
    border-color: rgba(161, 98, 7, 0.2);
    background: var(--al-warning-soft, #fff8e5);
}

.hedge-calculator__protection[data-hedge-status="loss"] {
    border-color: rgba(185, 28, 28, 0.16);
    background: rgba(254, 226, 226, 0.62);
}

.hedge-calculator__result-label {
    display: block;
    color: var(--al-success, #166534);
    font-size: var(--al-text-md, 16px);
    font-weight: 800;
}

.hedge-calculator__protection[data-hedge-status="breakeven"] .hedge-calculator__result-label {
    color: var(--al-warning, #9b5e00);
}

.hedge-calculator__protection[data-hedge-status="loss"] .hedge-calculator__result-label {
    color: #991b1b;
}

.hedge-calculator__suggested-stakes {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--al-space-5, 20px);
    margin-top: var(--al-space-3, 12px);
}

.hedge-calculator__suggested-stakes[data-hedge-outcomes="2"] > div:first-child {
    grid-column: 1 / -1;
}

.hedge-calculator__suggested-stakes strong,
.hedge-calculator__suggested-stakes span {
    display: block;
}

.hedge-calculator__protection[data-hedge-status="breakeven"] .hedge-calculator__suggested-stakes strong,
.hedge-calculator__protection[data-hedge-status="breakeven"] .hedge-calculator__suggested-stakes span {
    color: var(--al-warning, #9b5e00);
}

.hedge-calculator__protection[data-hedge-status="loss"] .hedge-calculator__suggested-stakes strong,
.hedge-calculator__protection[data-hedge-status="loss"] .hedge-calculator__suggested-stakes span {
    color: #991b1b;
}

.hedge-calculator__suggested-stakes strong {
    color: var(--al-success, #166534);
    font-size: clamp(2rem, 7vw, 3rem);
    font-weight: 850;
    letter-spacing: -0.04em;
    line-height: 1;
}

.hedge-calculator__suggested-stakes span {
    margin-top: var(--al-space-2, 8px);
    color: var(--al-success, #166534);
    font-weight: 750;
}

.hedge-calculator__outcome {
    display: grid;
    gap: var(--al-space-1, 4px);
    margin-top: var(--al-space-6, 24px);
    padding-top: var(--al-space-5, 20px);
    border-top: 1px solid rgba(22, 101, 52, 0.28);
}

.hedge-calculator__outcome strong {
    color: var(--al-text, #0f172a);
    font-size: var(--al-text-xl, 20px);
    line-height: 1.25;
}

.hedge-calculator__outcome span {
    color: var(--al-muted, #64748b);
}

.hedge-calculator__metrics {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0;
    margin: var(--al-space-5, 20px) 0 0;
    padding-top: var(--al-space-5, 20px);
    border-top: 1px solid rgba(22, 101, 52, 0.28);
}

.hedge-calculator__metrics > div {
    min-width: 0;
}

.hedge-calculator__metrics > div + div {
    margin-left: var(--al-space-5, 20px);
    padding-left: var(--al-space-5, 20px);
    border-left: 1px solid rgba(22, 101, 52, 0.28);
}

.hedge-calculator__metrics dt {
    color: var(--al-muted, #64748b);
    font-size: var(--al-text-sm, 14px);
    font-weight: 700;
}

.hedge-calculator__metrics dd {
    margin: var(--al-space-1, 4px) 0 0;
    color: var(--al-text, #0f172a);
    font-size: var(--al-text-lg, 18px);
    font-weight: 800;
}

.hedge-calculator__scenarios h3 {
    margin: 0 0 var(--al-space-3, 12px);
    color: var(--al-text, #0f172a);
}

.hedge-calculator__scenarios ul {
    margin: 0;
    padding: 0;
    overflow: hidden;
    border: 1px solid rgba(15, 23, 42, 0.14);
    border-radius: var(--al-radius-md, 12px);
    background: var(--al-surface, #fff);
    list-style: none;
}

.hedge-calculator__scenarios li {
    display: grid;
    grid-template-columns: 40px minmax(0, 1fr) auto;
    align-items: center;
    gap: var(--al-space-3, 12px);
    padding: var(--al-space-4, 16px);
}

.hedge-calculator__scenarios li + li {
    border-top: 1px solid rgba(15, 23, 42, 0.12);
}

.hedge-calculator__scenario-number {
    display: grid;
    place-items: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--al-page, #f8fafc);
    color: var(--al-text, #0f172a);
    font-weight: 800;
}

.hedge-calculator__scenario-copy,
.hedge-calculator__scenario-net {
    display: grid;
    gap: 2px;
    min-width: 0;
}

.hedge-calculator__scenario-copy strong {
    color: var(--al-text, #0f172a);
    line-height: 1.35;
}

.hedge-calculator__scenario-copy > span,
.hedge-calculator__scenario-net > span {
    color: var(--al-muted, #64748b);
    font-size: var(--al-text-sm, 14px);
}

.hedge-calculator__scenario-net {
    justify-items: end;
    text-align: right;
}

.hedge-calculator__scenario-net strong {
    color: var(--al-success, #166534);
    font-size: var(--al-text-lg, 18px);
}

.hedge-calculator__scenario-net strong[data-result-tone="loss"] {
    color: #991b1b;
}

.hedge-calculator__scenario-net strong[data-result-tone="neutral"] {
    color: var(--al-warning, #9b5e00);
}

.hedge-calculator__details {
    color: var(--al-muted, #64748b);
    font-size: var(--al-text-sm, 14px);
}

.hedge-calculator__details summary {
    width: fit-content;
    color: var(--al-primary, #2563eb);
    font-size: var(--al-text-md, 16px);
    font-weight: 700;
    text-decoration: underline;
    text-underline-offset: 3px;
    cursor: pointer;
}

.hedge-calculator__details p {
    margin: var(--al-space-3, 12px) 0 0;
}

.hedge-calculator__disclaimer {
    margin: 0;
    padding-top: var(--al-space-5, 20px);
    border-top: 1px solid rgba(15, 23, 42, 0.1);
    font-size: var(--al-text-sm, 14px);
}

@media (max-width: 760px) {
    .hedge-calculator {
        gap: var(--al-space-7, 28px);
        padding: var(--al-space-5, 20px);
        border-color: rgba(15, 23, 42, 0.08);
        box-shadow: none;
    }

    .hedge-calculator__settings {
        grid-template-columns: 1fr;
    }

    .hedge-calculator__fields {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .hedge-calculator__field--stake,
    .hedge-calculator__field--additional {
        grid-column: 1 / -1;
    }

    .hedge-calculator__field small {
        display: none;
    }
}

@media (max-width: 480px) {
    .hedge-calculator {
        margin-right: calc(var(--al-space-4, 16px) * -1);
        margin-left: calc(var(--al-space-4, 16px) * -1);
        padding-right: var(--al-space-4, 16px);
        padding-left: var(--al-space-4, 16px);
        border-right: 0;
        border-left: 0;
        border-radius: 0;
    }

    .hedge-calculator__header h2 {
        font-size: clamp(1.55rem, 7vw, 1.9rem);
    }

    .hedge-calculator__segments label > span {
        min-height: 50px;
        padding: 10px 8px;
    }

    .hedge-calculator__fields {
        gap: var(--al-space-3, 12px);
    }

    .hedge-calculator__field > span:first-child {
        font-size: var(--al-text-sm, 14px);
    }

    .hedge-calculator__protection {
        padding: var(--al-space-5, 20px);
    }

    .hedge-calculator__suggested-stakes {
        grid-template-columns: 1fr;
    }

    .hedge-calculator__scenarios li {
        grid-template-columns: 32px minmax(0, 1fr) auto;
        gap: var(--al-space-2, 8px);
        padding: var(--al-space-3, 12px);
    }

    .hedge-calculator__scenario-number {
        width: 30px;
        height: 30px;
        font-size: var(--al-text-sm, 14px);
    }

    .hedge-calculator__scenario-copy strong,
    .hedge-calculator__scenario-net strong {
        font-size: var(--al-text-sm, 14px);
    }

    .hedge-calculator__scenario-copy > span,
    .hedge-calculator__scenario-net > span {
        font-size: var(--al-text-xs, 12px);
    }
}

@media (prefers-reduced-motion: reduce) {
    .hedge-calculator__segments label > span,
    .hedge-calculator__protection {
        transition: none;
    }
}
