.navbar {
    --bs-navbar-padding-y: 0.75rem !important;
}

body {
    font-family: 'Inter', sans-serif !important;
    font-size: 15px !important;
}

.c-nav-button {
    padding: 0.3rem 1rem;
    margin: 0 0.3rem;
    background-color:white;
    border-color: white;
}

.c-nav-button-active {
    font-weight: bold;
}

.btn {
    --bs-btn-padding-x: 0.8rem;
    --bs-btn-padding-y: 0.3rem;

    --bs-btn-font-size: 14px;
    --bs-btn-font-family: 'Inter', sans-serif;
}

.c-btn-controls {
    --bs-btn-padding-x: 1rem;
    --bs-btn-padding-y: 0.1rem;
}

.dropdown-menu {
    --bs-dropdown-font-size: 14px;
}

.dropdown-menu > li {
    padding-left: 16px;
}

.table th {
    color: rgb(73, 80, 87);
}

.c-no-pad-card {
    padding-left:0; padding-right: 0; padding-bottom: 0
}

.c-btn-bkg-white {
    background-color:white;
}

.table>:not(caption)>*>* {
    padding: .3rem .5rem;
}

@media only screen and (max-width: 1400px) {
    .c-rem-gap {
        margin-bottom: 1rem;
    }

}

@media only screen and (max-width: 1200px) {
    .smallCenter {
        text-align:center !important;
    }
}

@media only screen and (min-width: 726px) and (max-width: 1000px) {

    #indexTable, #currentTable, #dealsTable, #historyTable {

        /* Force table to not be like tables anymore */
        table, thead, tbody, th, td, tr {
            display: block;
        }

        /* Hide table headers (but not display: none;, for accessibility) */
        thead tr {
            position: absolute;
            top: -9999px;
            left: -9999px;
        }

        tr {
            border: 1px solid #ccc;
            display: flex;
            flex-wrap: wrap;
            align-items: stretch;
        }

        tbody tr + tr {
            margin-top: 1rem;
        }

        td {
            border: none;
            border-bottom: 1px solid #eee;
            position: relative;
            box-sizing: border-box;
            flex: 0 0 100%;
            padding-left: 6px;
        }

        td:before {
            position: absolute;
            top: 6px;
            left: 6px;
            padding-right: 10px;
            white-space: nowrap;
            text-align: left;
        }
    }

    #indexTable {

        td:nth-of-type(1):before  { content: "USER"; }
        td:nth-of-type(2):before  { content: "COIN"; }
        td:nth-of-type(3):before  { content: "SIDE"; }
        td:nth-of-type(4):before  { content: "DURATION"; }
        td:nth-of-type(5):before  { content: "AMOUNT"; }
        td:nth-of-type(6):before  { content: "ORDERS"; }
        td:nth-of-type(7):before  { content: "uP&L"; }
        td:nth-of-type(8):before  { content: "rP&L"; }
        td:nth-of-type(9):before  { content: "BALANCE"; }
        td:nth-of-type(10):before { content: "RULES"; }
        td:nth-of-type(11):before { content: "CONTROLS"; }

        /* Line 1: USER | COIN | SIDE — adds up to 100%, so nothing else fits */
        td:nth-of-type(-n+3) {
            display: flex;
            align-items: center;
        }
        td:nth-of-type(1) { flex: 0 0 30%; }
        td:nth-of-type(2) { flex: 0 0 40%; gap: 4px; }
        td:nth-of-type(3) { flex: 0 0 30%; justify-content: flex-end; }

        /* Lines 2 and 3: labelled cells */
        td:nth-of-type(n+4):nth-of-type(-n+9) {
            padding-left: 6rem;
            white-space: nowrap;
        }

        /* Same three columns on lines 2 and 3, so they line up:
           DURATION | AMOUNT | ORDERS
           uP&L     | rP&L   | BALANCE */
        td:nth-of-type(4), td:nth-of-type(7) { flex: 0 0 36%; }
        td:nth-of-type(5), td:nth-of-type(8) { flex: 0 0 28%; }
        td:nth-of-type(6), td:nth-of-type(9) { flex: 0 0 36%; }

        /* Column dividers */
        td:nth-of-type(4),
        td:nth-of-type(5),
        td:nth-of-type(7),
        td:nth-of-type(8) {
            border-right: 1px solid #eee;
        }

        /* Last line: RULES and CONTROLS */
        td:nth-of-type(10),
        td:nth-of-type(11) {
            display: flex;
        }
        td:nth-of-type(10) {
            flex: 1 1 0;
            min-width: 0;
            flex-direction: column;
            justify-content: center;
        }
        td:nth-of-type(11) {
            flex: 0 0 auto;
            align-items: center;
            justify-content: flex-end;
            gap: 8px;
            white-space: nowrap;
        }

        /* No labels on the first and last lines */
        td:nth-of-type(-n+3):before,
        td:nth-of-type(n+10):before {
            display: none;
        }
    }

    #currentTable {

        td:nth-of-type(1):before { content: "ACCOUNT"; }
        td:nth-of-type(2):before { content: "BALANCE"; }
        td:nth-of-type(3):before { content: "EQUITY"; }
        td:nth-of-type(4):before { content: "uP&L"; }
        td:nth-of-type(5):before { content: "IM, %"; }
        td:nth-of-type(6):before { content: "ORDERS"; }
        td:nth-of-type(7):before { content: "AMOUNTS"; }
        td:nth-of-type(8):before { content: "CONTROLS"; }

        /* Visible grey grid between cells */
        td {
            border-bottom: 1px solid #ccc;
        }
        td:last-child {
            border-bottom: none;
        }

        /* Line 1: ACCOUNT, name on the left */
        td:nth-of-type(1) {
            text-align: left;
        }

        /* Lines 2 and 3: labelled cells, same label area everywhere */
        td:nth-of-type(n+2):nth-of-type(-n+7) {
            padding-left: 5.5rem;
            white-space: nowrap;
        }

        /* Same three columns on lines 2 and 3, so they line up:
           BALANCE | EQUITY | uP&L
           IM, %   | ORDERS | AMOUNTS */
        td:nth-of-type(2), td:nth-of-type(5) { flex: 0 0 28%; }
        td:nth-of-type(3), td:nth-of-type(6) { flex: 0 0 28%; }
        td:nth-of-type(4), td:nth-of-type(7) { flex: 0 0 44%; }

        /* Column dividers */
        td:nth-of-type(2),
        td:nth-of-type(3),
        td:nth-of-type(5),
        td:nth-of-type(6) {
            border-right: 1px solid #ccc;
        }

        /* No labels on the first and last lines */
        td:nth-of-type(1):before,
        td:nth-of-type(8):before {
            display: none;
        }
    }

    #dealsTable {

        td:nth-of-type(1):before { content: "COIN"; }
        td:nth-of-type(2):before { content: "SIDE"; }
        td:nth-of-type(3):before { content: "DURATION"; }
        td:nth-of-type(4):before { content: "AMOUNT"; }
        td:nth-of-type(5):before { content: "ORDERS"; }
        td:nth-of-type(6):before { content: "uP&L"; }
        td:nth-of-type(7):before { content: "rP&L"; }
        td:nth-of-type(8):before { content: "BALANCE"; }
        td:nth-of-type(9):before { content: "CONTROLS"; }

        /* Line 1: COIN | SIDE — adds up to 100% */
        td:nth-of-type(-n+2) {
            display: flex;
            align-items: center;
        }
        td:nth-of-type(1) { flex: 0 0 60%; gap: 4px; }
        td:nth-of-type(2) { flex: 0 0 40%; justify-content: flex-end; }

        /* Lines 2 and 3: labelled cells */
        td:nth-of-type(n+3):nth-of-type(-n+8) {
            padding-left: 5.5rem;
            white-space: nowrap;
        }

        /* Same three columns on lines 2 and 3:
           DURATION | AMOUNT | ORDERS
           uP&L     | rP&L   | BALANCE */
        td:nth-of-type(3), td:nth-of-type(6) { flex: 0 0 34%; }
        td:nth-of-type(4), td:nth-of-type(7) { flex: 0 0 26%; }
        td:nth-of-type(5), td:nth-of-type(8) { flex: 0 0 40%; }

        /* Column dividers */
        td:nth-of-type(3),
        td:nth-of-type(4),
        td:nth-of-type(6),
        td:nth-of-type(7) {
            border-right: 1px solid #eee;
        }

        /* Last line: CONTROLS (value + buttons), right-aligned */
        td:nth-of-type(9) {
            display: flex;
            align-items: center;
            justify-content: flex-end;
            gap: 8px;
            white-space: nowrap;
        }

        /* No labels on first and last lines */
        td:nth-of-type(-n+2):before,
        td:nth-of-type(9):before {
            display: none;
        }
    }

    #historyTable {

        td:nth-of-type(1):before  { content: "COIN"; }
        td:nth-of-type(2):before  { content: "SIDE"; }
        td:nth-of-type(3):before  { content: "STATUS"; }
        td:nth-of-type(4):before  { content: "AMOUNT"; }
        td:nth-of-type(5):before  { content: "DEALS"; }
        td:nth-of-type(6):before  { content: "BUY TIME"; }
        td:nth-of-type(7):before  { content: "DURATION"; }
        td:nth-of-type(8):before  { content: "SELL TIME"; }
        td:nth-of-type(9):before  { content: "REALIZED PnL"; }
        td:nth-of-type(10):before { content: "CLOSE PnL"; }
        td:nth-of-type(11):before { content: "PROFIT"; }

        /* Keep empty cells (open deals) at normal line height */
        td:empty::after {
            content: "\00a0";
        }

        /* Line 1: COIN | SIDE | STATUS
           Line 3: BUY TIME | DURATION | SELL TIME
           Equal thirds, no labels, left / middle / right */
        td:nth-of-type(-n+3),
        td:nth-of-type(n+6):nth-of-type(-n+8) {
            flex: 0 0 calc(100% / 3);
            min-width: 0;
        }
        td:nth-of-type(1), td:nth-of-type(6) { text-align: left !important; }
        td:nth-of-type(2), td:nth-of-type(7) { text-align: center !important; }
        td:nth-of-type(3), td:nth-of-type(8) { text-align: right !important; }

        td:nth-of-type(-n+3):before,
        td:nth-of-type(n+6):nth-of-type(-n+8):before {
            display: none;
        }

        /* Line 2: AMOUNT | DEALS
           Line 4: REALIZED PnL | CLOSE PnL
           Two halves, label left, value right */
        td:nth-of-type(4),
        td:nth-of-type(5),
        td:nth-of-type(9),
        td:nth-of-type(10) {
            display: flex;
            align-items: center;
            justify-content: space-between;
            gap: 8px;
            flex: 0 0 50%;
            min-width: 0;
        }
        td:nth-of-type(4):before,
        td:nth-of-type(5):before,
        td:nth-of-type(9):before,
        td:nth-of-type(10):before {
            position: static;
            width: auto;
            padding-right: 0;
        }

        /* Dividers */
        td:nth-of-type(1), td:nth-of-type(2),
        td:nth-of-type(6), td:nth-of-type(7),
        td:nth-of-type(4), td:nth-of-type(9) {
            border-right: 1px solid #eee;
        }

        /* Line 5: PROFIT, full width with label */
        td:nth-of-type(11) {
            padding-left: 6rem;
        }

        td {
            border-bottom: 1px solid #ccc;
        }
        td:last-child {
            border-bottom: none;            /* the row's own border closes the block */
        }
    }
}

@media only screen and (max-width: 725px) {

    #indexTable, #currentTable, #statsTable, #dealsTable, #historyTable {

        /* Force table to not be like tables anymore */
        table, thead, tbody, th, td, tr {
            display: block;
        }

        /* Hide table headers (but not display: none;, for accessibility) */
        thead tr {
            position: absolute;
            top: -9999px;
            left: -9999px;
        }

        tr { border: 1px solid #ccc; }

        td {
            /* Behave  like a "row" */
            border: none;
            border-bottom: 1px solid #eee;
            position: relative;
            padding-left: 50%;
        }

        td:before {
            /* Now like a table header */
            position: absolute;
            /* Top/left values mimic padding */
            top: 6px;
            left: 6px;
            width: 45%;
            padding-right: 10px;
            white-space: nowrap;
        }

        tbody tr + tr {
            margin-top: 1rem;
        }
    }

    #indexTable {

        td:nth-of-type(1):before  { content: "USER"; }
        td:nth-of-type(2):before  { content: "COIN"; }
        td:nth-of-type(3):before  { content: "SIDE"; }
        td:nth-of-type(4):before  { content: "DURATION"; }
        td:nth-of-type(5):before  { content: "AMOUNT"; }
        td:nth-of-type(6):before  { content: "ORDERS"; }
        td:nth-of-type(7):before  { content: "uP&L"; }
        td:nth-of-type(8):before  { content: "rP&L"; }
        td:nth-of-type(9):before  { content: "BALANCE"; }
        td:nth-of-type(10):before { content: "RULES"; }
        td:nth-of-type(11):before { content: "CONTROLS"; }

        /* Row becomes a wrapping flex container; cells stretch to equal height per line */
        tr {
            display: flex;
            flex-wrap: wrap;
            align-items: stretch;
        }

        /* Default: every cell takes a full line (DURATION, BALANCE) */
        td {
            flex: 0 0 100%;
            box-sizing: border-box;
        }

        /* Line 1: USER, COIN, SIDE */
        td:nth-of-type(-n+3) {
            display: flex;
            align-items: center;
            flex: 1 1 auto;
            width: auto;
            padding-left: 6px;
        }
        td:nth-of-type(2) { gap: 4px; }
        td:nth-of-type(3) { justify-content: flex-end; }

        /* Lines 3 and 4: AMOUNT + ORDERS, uP&L + rP&L — two halves each */
        td:nth-of-type(n+5):nth-of-type(-n+8) {
            display: flex;
            align-items: center;
            justify-content: space-between;
            gap: 8px;
            flex: 0 0 50%;   /* exactly half the line, so only two fit */
            min-width: 0;
            padding-left: 6px;
        }
        /* Label becomes a normal flex item instead of absolutely positioned */
        td:nth-of-type(n+5):nth-of-type(-n+8):before {
            position: static;
            width: auto;
            padding-right: 0;
        }
        /* Divider between the two halves */
        td:nth-of-type(5),
        td:nth-of-type(7) {
            border-right: 1px solid #eee;
        }
        td:nth-of-type(6),
        td:nth-of-type(8) {
            flex-basis: 50%;
        }

        /* Last line: RULES and CONTROLS */
        td:nth-of-type(10),
        td:nth-of-type(11) {
            display: flex;
            padding-left: 6px;
        }
        td:nth-of-type(10) {
            flex: 1 1 0;
            min-width: 0;
            flex-direction: column;
            justify-content: center;
        }
        td:nth-of-type(11) {
            flex: 0 0 auto;
            align-items: center;
            justify-content: flex-end;
            gap: 8px;
            white-space: nowrap;
        }

        /* No pseudo-labels on the first and last lines */
        td:nth-of-type(-n+3):before,
        td:nth-of-type(n+10):before {
            display: none;
        }

        td:nth-of-type(4):before,
        td:nth-of-type(9):before {
            text-align: left;
        }
    }

    #currentTable {

        td:nth-of-type(1):before { content: "ACCOUNT"; }
        td:nth-of-type(2):before { content: "BALANCE"; }
        td:nth-of-type(3):before { content: "EQUITY"; }
        td:nth-of-type(4):before { content: "uP&L"; }
        td:nth-of-type(5):before { content: "IM, %"; }
        td:nth-of-type(6):before { content: "ORDERS"; }
        td:nth-of-type(7):before { content: "AMOUNTS"; }
        td:nth-of-type(8):before { content: "CONTROLS"; }

        /* Row becomes a wrapping flex container */
        tr {
            display: flex;
            flex-wrap: wrap;
            align-items: stretch;
        }

        /* Default: every cell takes a full line */
        td {
            flex: 0 0 100%;
            box-sizing: border-box;
        }

        /* ACCOUNT: no label, username on the left */
        td:nth-of-type(1) {
            padding-left: 6px;
            text-align: left;
        }

        /* IM, % + ORDERS on one line, half each */
        td:nth-of-type(5),
        td:nth-of-type(6) {
            flex: 0 0 50%;
            padding-left: 5.5rem;   /* room for the label inside the half cell */
        }
        td:nth-of-type(5) {
            border-right: 1px solid #eee;
        }

        /* AMOUNTS: smaller fixed label area instead of 50%, never wraps */
        td:nth-of-type(7) {
            padding-left: 7rem;
            white-space: nowrap;
        }

        /* Labels on half cells and AMOUNTS: left-aligned, only as wide as the text */
        td:nth-of-type(5):before,
        td:nth-of-type(6):before,
        td:nth-of-type(7):before {
            width: auto;
            text-align: left;
        }

        /* CONTROLS: no label, buttons use the full width */
        td:nth-of-type(8) {
            padding-left: 6px;
        }

        /* Hide ACCOUNT and CONTROLS labels */
        td:nth-of-type(1):before,
        td:nth-of-type(8):before {
            display: none;
        }

        td:nth-of-type(2):before,
        td:nth-of-type(3):before,
        td:nth-of-type(4):before {
            text-align: left;
        }

        /* Visible grey grid between cells */
        td {
            border-bottom: 1px solid #ccc;
        }
        td:nth-of-type(5) {
            border-right: 1px solid #ccc;   /* divider between IM and ORDERS */
        }
        td:last-child {
            border-bottom: none;            /* the row's own border closes the block */
        }
    }

    #statsTable {

        td:nth-of-type(1):before { content: "ACCOUNT"; }
        td:nth-of-type(2):before { content: "BALANCE"; }
        td:nth-of-type(3):before { content: "TODAY"; }
        td:nth-of-type(4):before { content: "YESTERDAY"; }
        td:nth-of-type(5):before { content: "7 DAYS"; }

        /* Spacing between blocks */
        tbody tr + tr {
            margin-top: 1rem;
        }

        /* Visible grey grid between cells */
        td {
            border-bottom: 1px solid #ccc;
            box-sizing: border-box;
        }
        td:last-child {
            border-bottom: none;
        }

        /* ACCOUNT: no label, name on the left as a header line */
        td:nth-of-type(1) {
            padding-left: 6px;
            text-align: left;
        }
        td:nth-of-type(1):before {
            display: none;
        }

        /* Other cells: fixed label area so values like "1 029.58 / 0.51%" never wrap */
        td:nth-of-type(n+2) {
            padding-left: 7rem;
            white-space: nowrap;
        }

        /* All labels left-aligned and only as wide as their text */
        td:before {
            width: auto;
            text-align: left;
        }
    }

    #dealsTable {

        td:nth-of-type(1):before { content: "COIN"; }
        td:nth-of-type(2):before { content: "SIDE"; }
        td:nth-of-type(3):before { content: "DURATION"; }
        td:nth-of-type(4):before { content: "AMOUNT"; }
        td:nth-of-type(5):before { content: "ORDERS"; }
        td:nth-of-type(6):before { content: "uP&L"; }
        td:nth-of-type(7):before { content: "rP&L"; }
        td:nth-of-type(8):before { content: "BALANCE"; }
        td:nth-of-type(9):before { content: "CONTROLS"; }

        tr {
            display: flex;
            flex-wrap: wrap;
            align-items: stretch;
        }

        /* Default: full line (DURATION, BALANCE) */
        td {
            flex: 0 0 100%;
            box-sizing: border-box;
        }

        /* Line 1: COIN | SIDE */
        td:nth-of-type(-n+2) {
            display: flex;
            align-items: center;
            flex: 1 1 auto;
            width: auto;
            padding-left: 6px;
        }
        td:nth-of-type(1) { gap: 4px; }
        td:nth-of-type(2) { justify-content: flex-end; }

        /* AMOUNT + ORDERS, uP&L + rP&L — two halves each */
        td:nth-of-type(n+4):nth-of-type(-n+7) {
            display: flex;
            align-items: center;
            justify-content: space-between;
            gap: 8px;
            flex: 0 0 50%;
            min-width: 0;
            padding-left: 6px;
        }
        td:nth-of-type(n+4):nth-of-type(-n+7):before {
            position: static;
            width: auto;
            padding-right: 0;
        }
        td:nth-of-type(4),
        td:nth-of-type(6) {
            border-right: 1px solid #eee;
        }

        /* Last line: CONTROLS (value + buttons), right-aligned */
        td:nth-of-type(9) {
            display: flex;
            align-items: center;
            justify-content: flex-end;
            gap: 8px;
            padding-left: 6px;
            white-space: nowrap;
        }

        /* No labels on first and last lines */
        td:nth-of-type(-n+2):before,
        td:nth-of-type(9):before {
            display: none;
        }

        td:nth-of-type(3):before,
        td:nth-of-type(8):before {
            text-align: left;
        }
    }

    #historyTable {

        td:nth-of-type(1):before  { content: "COIN"; }
        td:nth-of-type(2):before  { content: "SIDE"; }
        td:nth-of-type(3):before  { content: "STATUS"; }
        td:nth-of-type(4):before  { content: "AMOUNT"; }
        td:nth-of-type(5):before  { content: "DEALS"; }
        td:nth-of-type(6):before  { content: "BUY TIME"; }
        td:nth-of-type(7):before  { content: "DURATION"; }
        td:nth-of-type(8):before  { content: "SELL TIME"; }
        td:nth-of-type(9):before  { content: "rP&L"; }
        td:nth-of-type(10):before { content: "cP&L"; }
        td:nth-of-type(11):before { content: "PROFIT"; }

        /* Row becomes a wrapping flex container */
        tr {
            display: flex;
            flex-wrap: wrap;
            align-items: stretch;
        }

        /* Default: every cell takes a full line */
        td {
            flex: 0 0 100%;
            box-sizing: border-box;
        }

        /* Labels left-aligned */
        td:before {
            text-align: left;
        }

        /* Keep empty cells (open deals) at normal line height */
        td:empty::after {
            content: "\00a0";
        }

        /* Line 1: COIN (left) | SIDE (middle) | STATUS (right), no labels */
        td:nth-of-type(-n+3) {
            flex: 0 0 calc(100% / 3);
            min-width: 0;
            padding-left: 6px;
        }
        td:nth-of-type(1) { text-align: left; }
        td:nth-of-type(2) { text-align: center; }
        td:nth-of-type(3) { text-align: right; }
        td:nth-of-type(-n+3):before {
            display: none;
        }

        /* AMOUNT + DEALS, REALIZED PnL + CLOSE PnL: two halves each */
        td:nth-of-type(4),
        td:nth-of-type(5),
        td:nth-of-type(9),
        td:nth-of-type(10) {
            display: flex;
            align-items: center;
            justify-content: space-between;
            gap: 8px;
            flex: 0 0 50%;
            min-width: 0;
            padding-left: 6px;
        }
        td:nth-of-type(4):before,
        td:nth-of-type(5):before,
        td:nth-of-type(9):before,
        td:nth-of-type(10):before {
            position: static;
            width: auto;
            padding-right: 0;
        }

        /* Dividers between the halves */
        td:nth-of-type(4),
        td:nth-of-type(9) {
            border-right: 1px solid #eee;
        }

        td {
            border-bottom: 1px solid #ccc;
        }
        td:last-child {
            border-bottom: none;            /* the row's own border closes the block */
        }
    }
}