[data-bs-theme="light"] {
    .tab-home-tab {
        background: linear-gradient(135deg, #eeedea, #f9faff, #f7fff9);
    }

    .tab-search-tab {
        background: linear-gradient(135deg, #eef5f1, #f3f0ff, #f7fbff);
    }

    .tab-apps-tab {
        background: linear-gradient(135deg, #fffaf2, #f6fbff, #fff7fc);
    }

    .tab-docs-tab,
    .tab-wallet-tab,
    .tab-support-tab {
        background: linear-gradient(135deg, #fffdf8, #f9faff, #f7fff9);
    }

    .tab-notifications-tab {
        background: linear-gradient(135deg, #f5eeef, #f3f8ff, #f6fff4);
    }

    .tab-setting-tab {
        background: linear-gradient(135deg, #ecf1f4, #faf7ff, #f9fff6);
    }

    .layout-main main {
        background-color: var(--bs-gray-100);
    }
}

[data-bs-theme="dark"] {
    .layout-main {
        background: linear-gradient(135deg, #251f19, #141c26, #271921);
    }

    .layout-main main {
        background-color: var(--bs-black);
    }
}

/* Card lists/tables: do not use page-black (--bs-body-bg) on #171717 cards */
html[data-bs-theme] .layout-main .list-group {
    --bs-list-group-bg: transparent;
    --bs-list-group-color: inherit;
    --bs-list-group-border-color: var(--bs-border-color);
    width: 100%;
    max-width: none;
}

html[data-bs-theme] .layout-main .list-group-item {
    background-color: transparent;
    color: inherit;
}

html[data-bs-theme] .layout-main .list-group-item-action:hover,
html[data-bs-theme] .layout-main .list-group-item-action:focus {
    background-color: var(--field);
    color: inherit;
}

html[data-bs-theme] .layout-main .table {
    --bs-table-bg: transparent;
    --bs-table-striped-bg: color-mix(in srgb, var(--field) 55%, transparent);
    --bs-table-hover-bg: color-mix(in srgb, var(--field) 80%, transparent);
    --bs-table-border-color: var(--bs-border-color);
}

html[data-bs-theme="dark"] .layout-main .card .bg-body-tertiary,
html[data-bs-theme="dark"] .layout-main .modal .bg-body-tertiary {
    background-color: var(--field) !important;
}

/* =============== grid layout css */
.layout-main .app-wrapper {
    display: grid;
    grid-template-columns: 100%;
    grid-template-rows: auto 1fr auto;
    padding: 0;
    gap: 0;
    grid-template-areas:
        "header"
        "main"
        "footer";
}

.layout-main aside {
    grid-area: aside;
}

.layout-main main {
    grid-area: main;
}

.page-header {
    min-width: 0;
    max-width: 100%;
}

.page-header .avatar.avatar-text {
    overflow: hidden;
}

.page-header [data-theme-toggle] {
    width: 2rem;
    height: 2rem;
    padding: 0;
    line-height: 1;
}

.page-header .page-header-balance {
    font-variant-numeric: tabular-nums;
}

@media (max-width: 575.98px) {
    .page-header .btn-group-sm>.btn {
        padding-left: 0.4rem;
        padding-right: 0.4rem;
        font-size: 0.75rem;
    }

    .page-header #accountReplenishBtn,
    .page-header #accountDepositBtn {
        width: 2rem;
        height: 2rem;
        padding: 0;
        border-radius: 50%;
    }
}

.layout-main footer {
    grid-area: footer;
}

/* ============================= */
.layout-main aside .main-menu {
    height: calc(100vh - 32px);
}

.layout-main aside .main-menu .tab-content {
    overflow-y: auto;
    flex-grow: 1;
}

.tab-menu {
    position: fixed;
    bottom: 10px;
    width: min(440px, calc(100vw - 16px));
    background: var(--app-border);
    transform: translateX(-50%);
    left: 50%;
    z-index: 999;
    overflow: visible;
}

.tab-menu #themeToggle:hover {
    background: rgba(var(--bs-primary-rgb), .2) !important;
}

.tab-menu #themeToggle,
.tab-menu .nav-link {
    width: auto;
    height: auto;
    min-width: 0;
    padding: 4px 0 2px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent !important;
    color: inherit;
    border: 0;
}

.tab-menu .nav-link.active {
    background: transparent !important;
    color: var(--bs-primary);
}

.tab-menu .tab-menu-icon {
    width: 32px;
    height: 32px;
    flex-shrink: 0;
    transition: width .15s ease, height .15s ease, margin .15s ease, background .15s ease, box-shadow .15s ease, font-size .15s ease;
}

.tab-menu .nav-link.active .tab-menu-icon {
    width: 44px;
    height: 44px;
    margin-top: -14px;
    background: var(--bs-primary);
    color: #fff;
    box-shadow: 0 4px 12px rgba(var(--bs-primary-rgb), .35);
    font-size: 1.15rem;
}

.tab-menu-label {
    font-size: 10px;
    line-height: 1.15;
    font-weight: 600;
    max-width: 4.6rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sidebar-link {
    color: inherit;
    text-decoration: none;
}

/* =============== App menu   */
.app-menu .app-card {
    letter-spacing: 0.05em;
    overflow: hidden;
    display: flex;
    width: 80px;
    height: 80px;
    align-items: center;
    justify-content: center;
}

.app-menu a.active .app-card,
.app-menu a:hover .app-card {
    box-shadow: inset 0px -3px 0 1px var(--bs-primary);
    color: var(--bs-primary) !important;
    transition: var(--transition-3s);
}


/* ============= */
.vendor-list .sidebar-link {
    background-color: var(--app-border);
    border: 1px solid var(--bs-border-color);
}

.vendor-list .sidebar-link.active,
.vendor-list .sidebar-link:hover {
    background: var(--bs-primary);
    color: var(--bs-white);
    border-color: var(--bs-primary);
}

@media (min-width: 992px) {
    .layout-main .app-wrapper {
        grid-template-columns: 1fr;
        grid-template-rows: auto 1fr;
        grid-template-areas:
            "header"
            "main"
            "footer";
    }

    .layout-main main {
        height: calc(100vh - 88px);
        overflow-y: auto;
        border-radius: 28px;
        border: 5px solid var(--app-border);
        box-shadow: var(--bs-box-shadow-sm);
    }
}

@media (min-width: 1200px) {

    .layout-main .app-wrapper {
        grid-template-columns: 380px 1fr;
        grid-template-rows: auto 1fr;
        grid-template-areas:
            "aside header"
            "aside main"
            "aside footer";
    }

    .tab-menu {
        position: absolute;
        bottom: 30px;
        width: calc(100% - 60px);
    }

    .layout-main aside {
        padding-inline: 20px;
        padding-block: 12px;
    }

    .layout-main aside .main-menu {
        width: 340px;
    }

    .layout-main aside .main-menu .tab-content {
        margin-bottom: 40;
    }

}

@media (min-width: 1471px) {
    .layout-main .app-wrapper {
        grid-template-columns: 460px 1fr;
    }

    .layout-main aside {
        padding-inline: 66px;
    }
}

@media (max-width: 767.98px) {
    .layout-main footer {
        padding-bottom: 72px;
    }
}

@media (max-width: 1199.98px) {
    .layout-main aside {
        position: absolute;
    }
}

.layout-main.layout-desk .app-wrapper {
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr auto;
    grid-template-areas:
        "header"
        "main"
        "footer";
    width: 100%;
    max-width: 100%;
    overflow-x: clip;
}

body.layout-desk {
    overflow-x: clip;
    width: 100%;
    max-width: 100%;
}

.layout-main.layout-desk header,
.layout-main.layout-desk main,
.layout-main.layout-desk footer {
    max-width: 100%;
}

.layout-main.layout-desk aside {
    position: absolute;
    padding: 0;
}

.layout-main.layout-desk aside .main-menu {
    width: auto;
}

.layout-main.layout-desk .tab-menu {
    position: fixed;
    bottom: 10px;
    width: min(440px, calc(100% - 16px));
    left: 50%;
    transform: translateX(-50%);
    z-index: 1040;
}

.layout-main.layout-desk main {
    min-width: 0;
    overflow-x: clip;
}

.layout-main.layout-desk .container-fluid,
.layout-main.layout-desk .row,
#baBinaryDesk,
#baBinaryDesk .row>[class*="col-"],
#baBinaryDesk .card,
#baBinaryDesk .card-body {
    min-width: 0;
    max-width: 100%;
}

.ba-desk-toolbar {
    min-width: 0;
    width: 100%;
    max-width: 100%;
}

.ba-desk-toolbar .input-group,
.ba-desk-toolbar .form-select {
    min-width: 0;
}

.ba-desk-market {
    width: 100%;
    min-width: 0;
}

.ba-desk-tfs {
    min-width: 0;
    max-width: 100%;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
}

.ba-trade-notif {
    width: max-content;
    max-width: min(14rem, calc(100% - 1rem));
    z-index: 5;
    pointer-events: none;
}

.ba-trade-notif.position-fixed {
    top: 4.5rem !important;
    z-index: 1080;
}

.ba-binary-chart {
    position: relative;
    min-height: 180px;
    height: 36vh;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    overflow: hidden;
}

#baBinaryChartCanvas {
    position: absolute;
    inset: 0;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    height: 100%;
    overflow: hidden;
}

.ba-binary-chart svg {
    position: absolute;
    inset: 0;
    display: block;
    width: 100% !important;
    height: 100% !important;
    max-width: 100%;
    max-height: 100%;
}

#baDigitCircles {
    min-width: 0;
    max-width: 100%;
    overflow: hidden;
}

#baDigitCircles>[data-digit] {
    min-width: 0;
    flex: 1 1 0;
}

#baDigitArrowTrack {
    height: 14px;
}

.ba-digit-svg {
    width: min(40px, 100%);
    max-width: 100%;
    height: auto;
    display: block;
}

.ba-digit-pct {
    font-size: 0.75rem;
    line-height: 1.1;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

@media (max-width: 767.98px) {
    .ba-digit-svg {
        width: min(28px, 100%);
    }

    .ba-digit-pct {
        font-size: 0.55rem;
        letter-spacing: -0.04em;
        margin-top: 0.12rem !important;
    }
}

@media (min-width: 768px) {
    .ba-binary-chart {
        min-height: 260px;
        height: 42vh;
    }
}

@media (min-width: 992px) {
    .ba-binary-chart {
        min-height: 320px;
        height: min(48vh, 460px);
    }
}

.layout-main.layout-public .app-wrapper {
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr auto;
    grid-template-areas:
        "header"
        "main"
        "footer";
}

.layout-main.layout-public footer {
    margin-bottom: 0;
}

@media (min-width: 992px) {
    .layout-main.layout-public main {
        height: auto;
        min-height: calc(100vh - 88px);
    }
}

/* Match auth-page fields (login/register): 48px bar, unified fill, centered icons */
html[data-bs-theme] .layout-main .form-control,
html[data-bs-theme] .layout-main .form-select {
    height: 48px;
    min-height: 48px;
    padding: 0 14px;
    font-size: 16px;
    line-height: 1.25;
    background-color: var(--field);
    border: 1px solid var(--field-line);
    border-radius: 12px;
    color: var(--field-text);
    box-shadow: none;
}

/* Native lists ignore the closed-field color. Use system canvas so options stay readable. */
html[data-bs-theme] .layout-main select option,
html[data-bs-theme] .layout-main select optgroup {
    color: #121212 !important;
    background-color: #ffffff !important;
}

html[data-bs-theme] .layout-main .tw-icon-field {
    position: relative;
}

html[data-bs-theme] .layout-main .tw-icon-field-mark {
    position: absolute;
    left: 0;
    top: 0;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 48px;
    color: var(--field-muted);
    pointer-events: none;
}

html[data-bs-theme] .layout-main .tw-icon-field>.form-select {
    padding-left: 44px;
}

html[data-bs-theme] .layout-main textarea.form-control {
    height: auto;
    min-height: 96px;
    padding: 12px 14px;
    line-height: 1.45;
}

html[data-bs-theme] .layout-main input.form-control[type="file"] {
    height: auto;
    min-height: 48px;
    padding: 10px 14px;
}

html[data-bs-theme] .layout-main .form-control:focus,
html[data-bs-theme] .layout-main .form-select:focus,
html[data-bs-theme] .layout-main .form-control:focus-visible,
html[data-bs-theme] .layout-main .form-select:focus-visible {
    border-color: var(--bs-primary);
    box-shadow: 0 0 0 .2rem rgba(var(--bs-primary-rgb), .18);
    background-color: var(--field);
    color: var(--field-text);
    outline: none;
}

html[data-bs-theme] .layout-main .form-control::placeholder {
    color: var(--field-soft);
    font-size: 14px;
    line-height: 1.25;
}

html[data-bs-theme] .layout-main .form-control:disabled,
html[data-bs-theme] .layout-main .form-select:disabled,
html[data-bs-theme] .layout-main .form-control[readonly] {
    background-color: var(--field);
    color: var(--field-muted);
    opacity: .85;
}

html[data-bs-theme] .layout-main .form-floating>.form-control,
html[data-bs-theme] .layout-main .form-floating>.form-select {
    height: 48px;
    min-height: 48px;
}

html[data-bs-theme] .layout-main .form-floating>label {
    color: var(--field-muted);
}

html[data-bs-theme] .layout-main .input-group:not(.input-group-sm) {
    display: flex;
    flex-wrap: nowrap;
    align-items: stretch;
    width: 100%;
    height: 48px;
    min-height: 48px;
    border: 1px solid var(--field-line);
    border-radius: 12px;
    overflow: hidden;
    background-color: var(--field);
}

html[data-bs-theme] .layout-main .input-group:not(.input-group-sm)>.form-control,
html[data-bs-theme] .layout-main .input-group:not(.input-group-sm)>.form-select,
html[data-bs-theme] .layout-main .input-group:not(.input-group-sm)>.input-group-text,
html[data-bs-theme] .layout-main .input-group:not(.input-group-sm)>.btn {
    height: 46px;
    min-height: 46px;
    max-height: 46px;
    border: 0;
    box-shadow: none;
    font-size: 16px;
    line-height: 1.25;
}

html[data-bs-theme] .layout-main .input-group:not(.input-group-sm)>.form-control,
html[data-bs-theme] .layout-main .input-group:not(.input-group-sm)>.form-select,
html[data-bs-theme] .layout-main .input-group:not(.input-group-sm)>.input-group-text {
    background-color: transparent;
    color: var(--field-text);
}

html[data-bs-theme] .layout-main .input-group:not(.input-group-sm)>.form-control,
html[data-bs-theme] .layout-main .input-group:not(.input-group-sm)>.form-select {
    flex: 1 1 auto;
    width: 1%;
    min-width: 0;
    padding-top: 0;
    padding-bottom: 0;
    border-radius: 0;
}

html[data-bs-theme] .layout-main .input-group:not(.input-group-sm)>.input-group-text {
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--field-muted);
    padding: 0 .85rem;
}

html[data-bs-theme] .layout-main .input-group:not(.input-group-sm)>.input-group-text:has(.bi),
html[data-bs-theme] .layout-main .input-group:not(.input-group-sm)>[data-password-toggle] {
    width: 44px;
    padding: 0;
    cursor: pointer;
}

html[data-bs-theme] .layout-main .input-group:not(.input-group-sm)>.btn {
    border-radius: 0;
    display: inline-flex;
    align-items: center;
}

html[data-bs-theme] .layout-main .input-group:not(.input-group-sm):focus-within {
    border-color: var(--bs-primary);
    box-shadow: 0 0 0 .2rem rgba(var(--bs-primary-rgb), .18);
}

html[data-bs-theme] .layout-main .input-group:not(.input-group-sm) .form-control:focus,
html[data-bs-theme] .layout-main .input-group:not(.input-group-sm) .form-select:focus,
html[data-bs-theme] .layout-main .input-group:not(.input-group-sm) .form-control:focus-visible,
html[data-bs-theme] .layout-main .input-group:not(.input-group-sm) .form-select:focus-visible {
    box-shadow: none;
    border-color: transparent;
    outline: none;
}

html[data-bs-theme] .layout-main .form-control:-webkit-autofill,
html[data-bs-theme] .layout-main .form-control:-webkit-autofill:hover,
html[data-bs-theme] .layout-main .form-control:-webkit-autofill:focus {
    -webkit-text-fill-color: var(--field-text);
    caret-color: var(--field-text);
    box-shadow: 0 0 0 1000px var(--field) inset;
    transition: background-color 9999s ease-out;
}

html[data-bs-theme] .layout-main .iti {
    width: 100%;
    display: block;
}

html[data-bs-theme] .layout-main .iti input.form-control,
html[data-bs-theme] .layout-main .iti .iti__tel-input {
    width: 100%;
    height: 48px;
    min-height: 48px;
    font-size: 16px;
    background-color: var(--field);
    border: 1px solid var(--field-line);
    border-radius: 12px;
    color: var(--field-text);
}

html[data-bs-theme] .layout-main .form-control-sm,
html[data-bs-theme] .layout-main .form-select-sm,
html[data-bs-theme] .layout-main .input-group-sm>.form-control,
html[data-bs-theme] .layout-main .input-group-sm>.form-select,
html[data-bs-theme] .layout-main .input-group-sm>.input-group-text {
    height: auto;
    min-height: calc(1.5em + .5rem + 2px);
    max-height: none;
    font-size: .875rem;
    padding: .25rem .5rem;
    line-height: 1.5;
}

/* Keep the trade ticket compact */
html[data-bs-theme] .layout-desk #baBinaryDesk .form-control,
html[data-bs-theme] .layout-desk #baBinaryDesk .form-select,
html[data-bs-theme] .layout-desk .ba-desk-toolbar .form-control,
html[data-bs-theme] .layout-desk .ba-desk-toolbar .form-select {
    height: auto;
    min-height: calc(1.5em + .75rem + 2px);
    max-height: none;
    font-size: inherit;
    padding: .375rem .75rem;
    line-height: 1.5;
    border-radius: var(--bs-border-radius);
}