.bf-twap-order-type-cell {
    padding: 0 10px 12px;
}

.bf-twap-order-type,
.bf-twap-duration {
    box-sizing: border-box;
    height: 34px;
    border: 1px solid var(--bf-border, #2b3243);
    border-radius: 6px;
    background: var(--bf-panel, #1b2233);
    color: var(--bf-text, #eef1f6);
    padding: 0 10px;
    font: inherit;
    font-size: 13px;
    cursor: pointer;
    color-scheme: dark;
}

.bf-twap-order-type {
    width: 100%;
    text-align: left;
}

.bf-twap-settings-cell {
    padding: 0 10px 12px;
}

.bf-twap-reduce,
.bf-twap-algorithm-heading,
.bf-twap-check-label {
    display: flex;
    align-items: center;
}

.bf-twap-order-settings-row,
.bf-twap-settings-row {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    font-size: 12px;
}

.bf-twap-order-settings-row {
    align-items: center;
    min-height: 34px;
}

.bf-twap-settings-row {
    position: relative;
    align-items: start;
}

.bf-twap-reduce {
    gap: 6px;
    min-width: 0;
}

.bf-twap-reduce-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 20px;
    border: 0;
    padding: 0;
    background: transparent;
    font-size: 0;
    line-height: 1;
    cursor: pointer;
}

.bf-twap-reduce-label {
    color: var(--bf-text, #eef1f6);
    font-weight: 500;
    min-width: 0;
    line-height: 1.4;
    white-space: normal;
    word-break: keep-all;
}

.bf-twap-controls {
    display: grid;
    min-width: 0;
    gap: 8px;
}

.bf-twap-algorithm-heading {
    gap: 6px;
    min-height: 20px;
}

.bf-twap-check-label {
    gap: 5px;
    margin: 0;
    color: var(--bf-text, #eef1f6);
    font-weight: 500;
    white-space: nowrap;
    cursor: pointer;
}

.bf-twap-check-label .bf-twap-toggle,
.bf-twap-reduce-toggle {
    box-sizing: border-box;
    appearance: none;
    -webkit-appearance: none;
    position: relative;
    flex: 0 0 30px;
    width: 30px;
    height: 20px;
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 12px;
    background: #686b73;
    cursor: pointer;
}

.bf-twap-reduce-toggle > span {
    display: none;
}

.bf-twap-check-label .bf-twap-toggle::before,
.bf-twap-reduce-toggle::before {
    content: "";
    position: absolute;
    top: 3px;
    left: 3px;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #d9dbe1;
    transition: transform 0.15s ease;
}

.bf-twap-check-label .bf-twap-toggle:checked,
.bf-twap-reduce-toggle:has(.fa-toggle-large-on) {
    background: #41b37d;
}

.bf-twap-check-label .bf-twap-toggle:checked::before,
.bf-twap-reduce-toggle:has(.fa-toggle-large-on)::before {
    transform: translateX(10px);
    background: #fff;
}

.bf-twap-info-wrap {
    position: static;
    display: inline-flex;
    align-items: center;
    flex: 0 0 16px;
}

.bf-twap-info {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    width: 16px;
    height: 16px;
    border: 1px solid var(--bf-muted, #a1a9b9);
    border-radius: 50%;
    padding: 0;
    background: transparent;
    color: var(--bf-muted, #a1a9b9);
    font: 600 11px/1 sans-serif;
    cursor: help;
}

.bf-twap-tooltip {
    position: absolute;
    z-index: 50;
    left: 0;
    bottom: calc(100% + 8px);
    box-sizing: border-box;
    width: 100%;
    max-height: min(360px, calc(100vh - 24px));
    overflow: auto;
    padding: 10px 12px;
    border: 1px solid var(--bf-border, #354052);
    border-radius: 7px;
    background: var(--bf-panel, #202838);
    color: var(--bf-text, #eef1f6);
    box-shadow: 0 4px 18px #0004;
    font-size: 12px;
    font-weight: 400;
    line-height: 1.6;
    text-align: left;
    white-space: normal;
    visibility: hidden;
    opacity: 0;
    pointer-events: none;
}

.bf-twap-info-wrap:hover .bf-twap-tooltip,
.bf-twap-info-wrap:focus-within .bf-twap-tooltip {
    visibility: visible;
    opacity: 1;
    pointer-events: auto;
}

.bf-twap-info:focus-visible {
    outline: 2px solid #45c7a1;
    outline-offset: 3px;
}

.bf-twap-duration {
    width: 100%;
    min-width: 0;
    padding: 0 8px;
    font-size: 12px;
}

.bf-twap-order-type:disabled,
.bf-twap-duration:disabled {
    opacity: 0.45;
    cursor: default;
}

.bf-twap-order-type:focus-visible,
.bf-twap-duration:focus-visible,
.bf-twap-check-label input:focus-visible,
.bf-twap-reduce-toggle:focus-visible,
.bf-twap-cancel:focus-visible {
    outline: 2px solid #45c7a1;
    outline-offset: 2px;
}

.bf-twap-position-tabs {
    width: 100%;
}

.bf-twap-position-tabs td {
    padding: 0 5px;
    font-size: 12px;
    white-space: nowrap;
}

html[data-binance-futures-theme] .bf-position-tabs > tbody > tr:first-child > td:first-child > .bf-twap-position-tabs {
    width: 100%;
    min-width: 0;
}

html[data-binance-futures-theme] .bf-position-tabs .bf-twap-position-tabs :is(#down_menu_1, #down_menu_2, #down_menu_3, #down_menu_6) {
    width: 25%;
    height: 31px;
    border: 0 !important;
    border-radius: 5px;
    background: transparent !important;
    color: #aab4c3 !important;
    font-size: 12px;
    cursor: pointer;
}

html[data-binance-futures-theme] .bf-position-tabs .bf-twap-position-tabs :is(#down_menu_1, #down_menu_2, #down_menu_3, #down_menu_6).btn_coin {
    background: #303a4b !important;
    color: #eef2f7 !important;
}

html[data-binance-futures-theme][color-scheme="light"] .bf-position-tabs .bf-twap-position-tabs :is(#down_menu_1, #down_menu_2, #down_menu_3, #down_menu_6) {
    color: #64748b !important;
}

html[data-binance-futures-theme][color-scheme="light"] .bf-position-tabs .bf-twap-position-tabs :is(#down_menu_1, #down_menu_2, #down_menu_3, #down_menu_6).btn_coin {
    background: #fff !important;
    color: #202938 !important;
}

html[data-binance-futures-theme][color-scheme="light"] :is(.bf-twap-order-type, .bf-twap-duration) {
    color-scheme: light;
}

.bf-twap-list {
    padding: 8px 0;
    text-align: left;
}

.bf-twap-list-status,
.bf-twap-empty,
.bf-twap-error {
    margin: 0 0 8px;
    padding: 10px 12px;
    border: 1px solid var(--bf-border, #2b3243);
    border-radius: 6px;
    color: var(--bf-muted, #a1a9b9);
    font-size: 12px;
    line-height: 1.5;
}

.bf-twap-list-status:empty {
    display: none;
}

.bf-twap-error {
    border-color: #78414a;
    color: #f18c96;
}

.bf-twap-orders {
    display: grid;
    gap: 8px;
}

.bf-twap-card {
    box-sizing: border-box;
    padding: 12px;
    border: 1px solid var(--bf-border, #2b3243);
    border-radius: 8px;
    background: var(--bf-panel, #1b2233);
    color: var(--bf-text, #eef1f6);
    font-size: 12px;
}

.bf-twap-header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px 10px;
}

.bf-twap-symbol {
    font-weight: 600;
    font-size: 13px;
}

.bf-twap-side,
.bf-twap-state {
    color: var(--bf-muted, #a1a9b9);
}

.bf-twap-countdown {
    margin-left: auto;
    font-variant-numeric: tabular-nums;
}

.bf-twap-progress {
    display: block;
    box-sizing: border-box;
    width: 100%;
    height: 6px;
    margin: 10px 0;
    overflow: hidden;
    border: 0;
    border-radius: 4px;
    background: #2b3243;
    accent-color: #45c7a1;
}

.bf-twap-progress::-webkit-progress-bar {
    background: #2b3243;
    border-radius: 4px;
}

.bf-twap-progress::-webkit-progress-value {
    background: #45c7a1;
    border-radius: 4px;
}

.bf-twap-progress::-moz-progress-bar {
    background: #45c7a1;
    border-radius: 4px;
}

.bf-twap-metrics {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px 14px;
    line-height: 1.6;
    color: var(--bf-muted, #a1a9b9);
}

.bf-twap-qty {
    font-variant-numeric: tabular-nums;
}

.bf-twap-cancel {
    box-sizing: border-box;
    min-height: 30px;
    margin-left: auto;
    padding: 3px 10px;
    border: 1px solid #78414a;
    border-radius: 5px;
    background: transparent;
    color: #f18c96;
    font: inherit;
    cursor: pointer;
}

.bf-twap-cancel:disabled {
    opacity: 0.5;
    cursor: default;
}

.bf-twap-confirm-overlay {
    position: fixed;
    z-index: 10060;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    padding: 16px;
    overflow: auto;
    background: #0008;
}

.bf-twap-confirm,
.bf-twap-confirm * {
    box-sizing: border-box;
}

.bf-twap-confirm {
    width: 100%;
    max-width: 420px;
    max-height: calc(100vh - 32px);
    max-height: calc(100dvh - 32px);
    overflow: auto;
    padding: 20px;
    border: 1px solid var(--bf-border, #354052);
    border-radius: 12px;
    background: var(--bf-panel, #1b2233);
    color: var(--bf-text, #edf1f7);
    box-shadow: 0 12px 40px #0003;
    font: 14px/1.55 sans-serif;
    text-align: left;
}

.bf-twap-confirm-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.bf-twap-confirm-title {
    min-width: 0;
    margin: 0;
    padding: 0;
    color: inherit;
    font: 500 17px/1.4 sans-serif;
    overflow-wrap: anywhere;
}

.bf-twap-confirm button {
    margin: 0;
    border: 0;
    border-radius: 6px;
    padding: 10px 14px;
    font: inherit;
    line-height: 1.5;
    white-space: normal;
    cursor: pointer;
}

.bf-twap-confirm .bf-twap-confirm-close {
    display: inline-flex;
    flex: 0 0 28px;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    padding: 0;
    background: transparent;
    color: var(--bf-muted, #a6afbf);
    font: 24px/1 sans-serif;
}

.bf-twap-confirm-symbol {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin: 16px 0 12px;
}

.bf-twap-confirm-symbol strong {
    min-width: 0;
    font-weight: 500;
    overflow-wrap: anywhere;
}

.bf-twap-confirm-symbol span {
    color: #41b37d;
}

.bf-twap-confirm[data-side="SELL"] .bf-twap-confirm-symbol span {
    color: #ef6671;
}

.bf-twap-confirm-details {
    margin: 0;
    padding: 7px 0 0;
    border-top: 1px solid var(--bf-border, #354052);
}

.bf-twap-confirm-details > div {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.35fr);
    gap: 16px;
    padding: 5px 0;
}

.bf-twap-confirm-details dt,
.bf-twap-confirm-details dd {
    min-width: 0;
    margin: 0;
    padding: 0;
    font: inherit;
    overflow-wrap: anywhere;
}

.bf-twap-confirm-details dt {
    color: var(--bf-muted, #a6afbf);
}

.bf-twap-confirm-details dd {
    color: inherit;
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.bf-twap-confirm-note {
    margin: 13px 0 16px;
    padding: 0;
    color: var(--bf-muted, #a6afbf);
    font-size: 12px;
    line-height: 1.6;
    overflow-wrap: anywhere;
}

.bf-twap-confirm-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.bf-twap-confirm .bf-twap-confirm-back {
    background: #273145;
    color: var(--bf-text, #edf1f7);
}

.bf-twap-confirm .bf-twap-confirm-submit {
    background: #41b37d;
    color: #fff;
}

.bf-twap-confirm[data-side="SELL"] .bf-twap-confirm-submit {
    background: #d74d5e;
}

.bf-twap-confirm button:focus-visible {
    outline: 2px solid #45c7a1;
    outline-offset: 2px;
}

.bf-twap-confirm button:disabled {
    opacity: 0.5;
    cursor: default;
}

.bf-twap-toast {
    position: fixed;
    z-index: 10080;
    top: 20px;
    left: 50%;
    box-sizing: border-box;
    width: min(420px, calc(100vw - 24px));
    transform: translateX(-50%);
}

#toast_popup:has(> .bf-twap-toast-message) {
    z-index: 10080;
    max-width: calc(100vw - 20px);
}

.bf-twap-toast-message,
#toast_popup p.bf-twap-toast-message {
    box-sizing: border-box;
    width: min(420px, calc(100vw - 24px));
    height: auto;
    min-height: 0;
    margin: 0 0 8px;
    padding: 12px 14px;
    overflow: visible;
    border: 1px solid #78414a;
    border-radius: 8px;
    background: #37232c;
    color: #ffb3bc;
    font: 500 13px/1.6 sans-serif;
    text-align: left;
    white-space: normal;
    overflow-wrap: anywhere;
}

html[data-binance-futures-theme][color-scheme="light"] .bf-twap-confirm-overlay {
    background: #12203544;
}

html[data-binance-futures-theme][color-scheme="light"] .bf-twap-confirm-symbol span {
    color: #278868;
}

html[data-binance-futures-theme][color-scheme="light"] .bf-twap-confirm[data-side="SELL"] .bf-twap-confirm-symbol span {
    color: #c54351;
}

html[data-binance-futures-theme][color-scheme="light"] .bf-twap-confirm .bf-twap-confirm-back {
    background: #edf1f7;
}

html[data-binance-futures-theme][color-scheme="light"] .bf-twap-confirm .bf-twap-confirm-submit {
    background: #278868;
}

html[data-binance-futures-theme][color-scheme="light"] .bf-twap-confirm[data-side="SELL"] .bf-twap-confirm-submit {
    background: #c54351;
}

html[data-binance-futures-theme][color-scheme="light"] .bf-twap-toast-message,
html[data-binance-futures-theme][color-scheme="light"] #toast_popup p.bf-twap-toast-message {
    border-color: #e3adb4;
    background: #fff0f0;
    color: #a22e3c;
}

@media (max-width: 390px) {
    .bf-twap-confirm-overlay {
        padding: 10px;
    }

    .bf-twap-confirm {
        max-height: calc(100vh - 20px);
        max-height: calc(100dvh - 20px);
        padding: 16px;
    }
}
