@import url('https://fonts.googleapis.com/css2?family=Nunito+Sans:ital,opsz,wght@0,6..12,200..1000;1,6..12,200..1000&display=swap');
@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;500;600;700&display=swap');

* {
    box-sizing: border-box;
    font-family: "Nunito Sans", sans-serif;
    font-optical-sizing: auto;
    font-weight: normal;
    font-style: normal;
    font-variation-settings:
        "wdth" 100,
        "YTLC" 500;
}

html,
body {
    margin: 0;
    padding: 0;
    color: white;
    background-color: #0d263f;
}

main {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: .75rem 1rem;
    min-height: calc(100vh - 40px);
}

main>h1 {
    display: none; /* fallback if any h1 is added back */
}

.list {
    display: flex;
    flex-wrap: wrap;
    max-width: 90%;
    gap: .75rem;
    justify-content: center;
}

.market-card {
    display: flex;
    flex-direction: column;
    width: 240px;
    padding: .7rem .9rem;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 6px;
    gap: .5rem;
    background: linear-gradient(135deg, rgba(255,255,255,0.03) 0%, rgba(255,255,255,0.01) 100%);
}

.market-card:hover {
    border-color: rgba(255, 255, 255, 0.18);
}

.mc-header {
    display: flex;
    align-items: flex-start;
    gap: .6rem;
    margin-bottom: .2rem;
}

.mc-icon {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    flex-shrink: 0;
}

.mc-question {
    margin: 0;
    font-size: .78rem;
    font-weight: 600;
    line-height: 1.3;
}
.mc-question a {
    color: inherit;
    text-decoration: none;
}
.mc-question a:hover {
    text-decoration: underline;
}

.mc-desc {
    margin: 0;
    font-size: .72rem;
    line-height: 1.4;
    color: rgba(255, 255, 255, 0.3);
    overflow: hidden;
    max-height: 2.8em;
    transition: max-height 0.3s ease, color 0.3s ease;
}

.market-card:hover .mc-desc {
    max-height: 8em;
    overflow-y: auto;
    color: rgba(255, 255, 255, 0.5);
}

.mc-desc::-webkit-scrollbar {
    width: 4px;
}

.mc-desc::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.15);
    border-radius: 2px;
}

.mc-outcomes {
    display: flex;
    justify-content: center;
    gap: 1.5rem;
}

.mc-outcomes.multi {
    flex-wrap: wrap;
    gap: .4rem .8rem;
}

.mc-outcome {
    display: flex;
    align-items: center;
    gap: .3rem;
}

.mc-label {
    font-size: .8rem;
    color: rgba(255, 255, 255, 0.5);
}

.mc-price {
    font-family: 'JetBrains Mono', monospace;
    font-weight: 600;
    font-size: .78rem;
}

.mc-price.yes { color: #6bc46b; }
.mc-price.no { color: #e87171; }
.mc-price.dim { color: rgba(255, 255, 255, 0.25); }

.mc-meta {
    display: grid;
    grid-template-columns: auto auto;
    gap: .3rem .5rem;
    justify-content: center;
    align-items: center;
    font-size: .78rem;
    color: rgba(255, 255, 255, 0.4);
    flex: 1;
    align-content: center;
}

.mc-status {
    flex-shrink: 0;
    align-self: flex-start;
    margin-left: auto;
    font-size: .65rem;
    padding: .15rem .45rem;
    white-space: nowrap;
}

.mc-vol-label {
    text-align: right;
    color: rgba(255, 255, 255, 0.35);
}

.mc-vol-value {
    white-space: nowrap;
}

.mc-actions {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: .6rem;
}

.arb-btn {
    padding: .3rem .9rem;
    font-size: .85rem;
    font-weight: 700;
    background-color: rgba(42, 125, 225, 0.15);
    border-color: #2a7de1;
    color: #2a7de1;
    cursor: pointer;
}

.arb-btn:hover {
    background-color: #2a7de1;
    color: white;
}

.arb-ok {
    color: #6bc46b;
    font-size: .85rem;
    font-weight: 600;
}

.arb-error {
    color: #e87171;
    font-size: .85rem;
    font-weight: 600;
}

.arb-skip {
    color: #d4a853;
    font-size: .85rem;
    font-weight: 600;
}

button {
    padding: .3rem .7rem;
    background-color: transparent;
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 4px;
    font-size: .82rem;
}

button:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

button.yes {
    background-color: #539153;
}

button.no {
    background-color: #e15353;
}

button>span {
    font-size: .72rem;
}

nav {
    display: flex;
    gap: 0;
    padding: 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    align-items: center;
    overflow: visible;
    position: relative;
    z-index: 10;
    background: linear-gradient(135deg, rgba(255,255,255,0.04) 0%, rgba(255,255,255,0.02) 100%);
    font-size: .78rem;
}

.nav-brand {
    font-family: 'JetBrains Mono', monospace;
    font-weight: 700;
    font-size: .75rem;
    letter-spacing: .08em;
    color: rgba(255,255,255,0.5);
    padding: 6px 14px;
    border-right: 1px solid rgba(255,255,255,0.06);
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 0;
    flex: 1;
}

#balance {
    font-family: 'JetBrains Mono', monospace;
    font-weight: 600;
    color: #4ade80;
    font-size: .75rem;
    padding: 6px 12px;
    border-left: 1px solid rgba(255,255,255,0.06);
}

nav a {
    color: rgba(255, 255, 255, 0.5);
    text-decoration: none;
    font-family: 'JetBrains Mono', monospace;
    font-size: .68rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: .04em;
    padding: 8px 10px;
    transition: color .12s, background .12s;
}

nav a:hover {
    color: rgba(255, 255, 255, 0.85);
    background: rgba(255,255,255,0.04);
}

.nav-btn {
    font-family: 'JetBrains Mono', monospace;
    font-size: .62rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .04em;
    padding: 3px 10px;
    background: transparent;
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 3px;
    color: rgba(255,255,255,0.35);
    cursor: pointer;
    transition: color .12s, background .12s, border-color .12s;
    margin: 0 8px;
}
.nav-btn:hover {
    color: rgba(255,255,255,0.7);
    border-color: rgba(255,255,255,0.2);
    background: rgba(255,255,255,0.04);
}

.orders-table {
    border-collapse: separate;
    border-spacing: 0;
    width: 100%;
    max-width: 1400px;
    font-size: .78rem;
}

.market-col {
    max-width: 180px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: .76rem;
    font-weight: 500;
    color: rgba(255,255,255,0.8);
}
.market-col a {
    color: inherit;
    text-decoration: none;
}
.market-col a:hover {
    text-decoration: underline;
    color: #fff;
}

.strategy-badge {
    background: rgba(100, 100, 255, 0.15);
    color: #aac4ff;
    font-family: 'JetBrains Mono', monospace;
    font-size: .6rem;
    font-weight: 600;
    letter-spacing: .03em;
}

.orders-table th,
.orders-table td {
    padding: 5px 8px;
    text-align: left;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
    white-space: nowrap;
    vertical-align: middle;
}

.orders-table th {
    font-family: 'JetBrains Mono', monospace;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.35);
    font-size: .62rem;
    text-transform: uppercase;
    letter-spacing: .06em;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    position: sticky;
    top: 0;
    background: #0d263f;
}

.orders-table tbody tr {
    transition: background .1s;
}
.orders-table tbody tr:hover {
    background: rgba(255,255,255,0.03);
}

.badge {
    padding: 2px 6px;
    border-radius: 3px;
    font-family: 'JetBrains Mono', monospace;
    font-weight: 600;
    font-size: .6rem;
    letter-spacing: .03em;
    text-transform: uppercase;
}

.badge.yes { background: rgba(80, 200, 120, 0.15); color: #50c878; }
.badge.no { background: rgba(255, 80, 80, 0.15); color: #ff6b6b; }
.badge.merge { background: rgba(160, 120, 255, 0.15); color: #a078ff; }
.badge.warn { background: rgba(255, 200, 50, 0.15); color: #ffc832; }
.badge.exit { background: rgba(255, 160, 50, 0.15); color: #ffa032; }

.btn-warn { background: rgba(255, 160, 50, 0.2); color: #ffa032; border-color: rgba(255, 160, 50, 0.4); }
.btn-warn:hover { background: rgba(255, 160, 50, 0.35); }

.cancel-btn {
    padding: .2rem .45rem;
    font-size: .72rem;
    font-weight: 600;
    background-color: rgba(225,83,83,0.15);
    border: 1px solid rgba(225,83,83,0.4);
    color: #ff7b7b;
    cursor: pointer;
    letter-spacing: .02em;
}

.cancel-btn:hover {
    background-color: #e15353;
    color: white;
}

.cancel-btn[disabled] {
    opacity: 0.5;
    cursor: wait;
}

.order-cancelled td {
    color: #539153;
    font-style: italic;
}

.order-error td {
    color: #e15353;
    font-style: italic;
}

.status-live {
    background-color: #2a7de1;
}

.status-matched {
    background-color: #539153;
}

.status-cancelled {
    background-color: rgba(255, 255, 255, 0.15);
    color: rgba(255, 255, 255, 0.5);
}

.status-other {
    background-color: rgba(255, 255, 255, 0.1);
}

/* Positions */

.positions-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
    gap: .6rem;
    margin-bottom: 1rem;
    width: 100%;
    max-width: 1400px;
}

.position-card {
    background: linear-gradient(135deg, rgba(255,255,255,0.03) 0%, rgba(255,255,255,0.01) 100%);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 6px;
    padding: .6rem .8rem;
}

.pos-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: .5rem;
    margin-bottom: .6rem;
}

.pos-question {
    font-weight: 600;
    font-size: .78rem;
    color: rgba(255,255,255,0.8);
    text-decoration: none;
    line-height: 1.3;
}

a.pos-question:hover {
    color: #fff;
    text-decoration: underline;
}

.pos-outcome {
    margin-bottom: .4rem;
    font-size: .78rem;
}

.pos-outcome-label {
    color: rgba(255, 255, 255, 0.5);
}

.pos-stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: .4rem;
}

.pos-stat {
    display: flex;
    flex-direction: column;
    gap: .1rem;
}

.pos-stat-label {
    font-family: 'JetBrains Mono', monospace;
    font-size: .58rem;
    color: rgba(255, 255, 255, 0.35);
    text-transform: uppercase;
    letter-spacing: .04em;
    font-weight: 500;
}

.pos-stat-value {
    font-family: 'JetBrains Mono', monospace;
    font-size: .75rem;
    font-weight: 500;
}

/* Filter bar */

.filter-bar {
    display: flex;
    gap: .4rem;
    margin-bottom: .75rem;
    align-items: center;
    flex-wrap: wrap;
    justify-content: center;
}

.filter-bar input[type="text"] {
    padding: 4px 8px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 4px;
    background-color: rgba(0, 0, 0, 0.2);
    color: white;
    font-size: .78rem;
    min-width: 180px;
}

.filter-bar input[type="text"]::placeholder {
    color: rgba(255, 255, 255, 0.25);
}

.filter-bar input[type="text"].htmx-request {
    border-color: #2a7de1;
}

#results.htmx-swapping {
    opacity: 0.5;
    transition: opacity 0.2s;
}

.filter-bar select {
    padding: 4px 8px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 4px;
    background-color: rgba(0, 0, 0, 0.2);
    color: white;
    font-size: .78rem;
}

.filter-bar select option {
    background-color: #0d263f;
    color: white;
}

.filter-check {
    padding: 4px 8px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 4px;
    background-color: rgba(0, 0, 0, 0.2);
    font-size: .78rem;
    color: rgba(255, 255, 255, 0.5);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: .4rem;
    transition: border-color 0.2s, color 0.2s;
}

.filter-check:hover {
    border-color: rgba(255, 255, 255, 0.35);
    color: white;
}

.filter-check:has(input:checked) {
    border-color: #2a7de1;
    color: white;
}

.filter-check input[type="checkbox"] {
    appearance: none;
    width: 14px;
    height: 14px;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 3px;
    background: rgba(255, 255, 255, 0.05);
    cursor: pointer;
    position: relative;
    flex-shrink: 0;
}

.filter-check input[type="checkbox"]:checked {
    background: #2a7de1;
    border-color: #2a7de1;
}

.filter-check input[type="checkbox"]:checked::after {
    content: "";
    position: absolute;
    left: 3px;
    top: 0px;
    width: 5px;
    height: 9px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.filter-info {
    margin: 0 0 .6rem 0;
    font-size: .78rem;
    color: rgba(255, 255, 255, 0.4);
}

.filter-info a {
    color: #2a7de1;
    text-decoration: none;
}

/* Events page */

.events-list {
    display: flex;
    flex-wrap: wrap;
    max-width: 90%;
    gap: .75rem;
    justify-content: center;
}

.event-card {
    display: flex;
    flex-direction: column;
    width: 250px;
    padding: .7rem .9rem;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 6px;
    gap: .5rem;
    text-decoration: none;
    color: white;
    transition: border-color 0.15s;
    background: linear-gradient(135deg, rgba(255,255,255,0.03) 0%, rgba(255,255,255,0.01) 100%);
}

.event-card:hover {
    border-color: rgba(255, 255, 255, 0.18);
}

.ec-header {
    display: flex;
    align-items: flex-start;
    gap: .6rem;
}

.ec-icon {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    flex-shrink: 0;
}

.ec-title {
    margin: 0;
    font-size: .78rem;
    font-weight: 600;
    line-height: 1.3;
}

.ec-meta {
    display: flex;
    align-items: center;
    gap: .6rem;
}

.ec-category {
    font-size: .78rem;
    color: rgba(255, 255, 255, 0.5);
}

/* Loading indicator for infinite scroll */

.load-more {
    width: 100%;
    display: flex;
    justify-content: center;
    padding: 1.5rem 0;
}

.spinner {
    width: 28px;
    height: 28px;
    border: 3px solid rgba(255, 255, 255, 0.15);
    border-top-color: #2a7de1;
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.end-msg {
    width: 100%;
    text-align: center;
    padding: 1rem;
    color: rgba(255, 255, 255, 0.3);
    font-size: .85rem;
}

.has-popup {
    position: relative;
    cursor: default;
    border-bottom: 1px dotted rgba(255,255,255,0.4);
}
.popup {
    display: none;
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    background: #1e1e32;
    color: #e0e0e0;
    padding: 6px 10px;
    border-radius: 6px;
    font-size: 0.8rem;
    white-space: nowrap;
    border: 1px solid rgba(255,255,255,0.12);
    box-shadow: 0 4px 12px rgba(0,0,0,0.4);
    z-index: 100;
}
.popup::before {
    content: "";
    position: absolute;
    bottom: 100%;
    right: 12px;
    border: 6px solid transparent;
    border-bottom-color: rgba(255,255,255,0.12);
}
.popup::after {
    content: "";
    position: absolute;
    bottom: 100%;
    right: 13px;
    border: 5px solid transparent;
    border-bottom-color: #1e1e32;
}
.has-popup:hover .popup {
    display: block;
}

/* Wallet page */

.wallet-address {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: .6rem .8rem;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 6px;
    margin-bottom: .6rem;
    max-width: 600px;
    width: 100%;
    background: linear-gradient(135deg, rgba(255,255,255,0.03) 0%, rgba(255,255,255,0.01) 100%);
}

.wa-info {
    display: flex;
    flex-direction: column;
    gap: .4rem;
    flex: 1;
    min-width: 0;
}

.wa-label {
    font-family: 'JetBrains Mono', monospace;
    font-size: .6rem;
    color: rgba(255, 255, 255, 0.35);
    text-transform: uppercase;
    font-weight: 600;
    letter-spacing: .04em;
}

.wa-addr {
    font-family: 'JetBrains Mono', monospace;
    font-size: .7rem;
    word-break: break-all;
    color: rgba(255, 255, 255, 0.7);
}

.copy-btn {
    padding: .15rem .4rem;
    font-size: .65rem;
    cursor: pointer;
    width: fit-content;
    transition: background-color 0.2s, color 0.2s, border-color 0.2s;
}

.wa-qr {
    width: 100px;
    height: 100px;
    border-radius: .4rem;
    flex-shrink: 0;
    border: 1px solid rgba(255, 255, 255, 0.12);
}

.wallet-balances {
    display: flex;
    gap: .5rem;
    margin-bottom: .75rem;
    flex-wrap: wrap;
    justify-content: center;
    max-width: 600px;
    width: 100%;
}

.wb-row {
    display: flex;
    align-items: center;
    gap: .4rem;
    padding: .4rem .7rem;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 4px;
    flex: 1;
    min-width: 120px;
    background: linear-gradient(135deg, rgba(255,255,255,0.03) 0%, rgba(255,255,255,0.01) 100%);
}

.wb-token {
    font-family: 'JetBrains Mono', monospace;
    font-weight: 600;
    font-size: .65rem;
    color: rgba(255, 255, 255, 0.4);
    text-transform: uppercase;
    letter-spacing: .03em;
}

.wb-amount {
    font-family: 'JetBrains Mono', monospace;
    font-weight: 600;
    font-size: .78rem;
    margin-left: auto;
}

.wallet-section {
    max-width: 600px;
    width: 100%;
    margin-bottom: 1.5rem;
}

.wallet-section h2 {
    font-family: 'JetBrains Mono', monospace;
    font-size: .65rem;
    font-weight: 600;
    color: rgba(255,255,255,0.35);
    text-transform: uppercase;
    letter-spacing: .06em;
    margin: 0 0 .5rem 0;
}

.wallet-form {
    display: flex;
    gap: .5rem;
    flex-wrap: wrap;
    align-items: center;
}

.wallet-form select,
.wallet-form input[type="text"] {
    padding: 4px 8px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    background-color: rgba(0, 0, 0, 0.2);
    color: white;
    font-family: 'JetBrains Mono', monospace;
    font-size: .78rem;
    flex: 1;
    min-width: 100px;
}

.wallet-form select option {
    background-color: #0d263f;
    color: white;
}

.wallet-form button {
    padding: .25rem .7rem;
    font-weight: 600;
    font-size: .78rem;
    background-color: rgba(42, 125, 225, 0.15);
    border-color: rgba(42, 125, 225, 0.4);
    color: #6b9eff;
    cursor: pointer;
}

.wallet-form button:hover {
    background-color: #4a7adf;
    color: white;
}

.wallet-form button[disabled] {
    opacity: 0.5;
    cursor: wait;
}

.wallet-section .orders-table {
    width: 100%;
    max-width: 100%;
}

.tx-hash {
    color: #2a7de1;
    text-decoration: none;
    font-family: monospace;
    font-size: .82rem;
}

.tx-hash:hover {
    text-decoration: underline;
}

.badge.tx-in {
    background-color: #539153;
}

.badge.tx-out {
    background-color: #e15353;
}

.status-swap {
    background-color: #8b5cf6;
}

.result-link {
    color: rgba(255, 255, 255, 0.7);
    text-decoration: underline;
    text-decoration-color: rgba(255, 255, 255, 0.3);
}

.result-link:hover {
    color: white;
}

.tx-section .orders-table {
    width: 100%;
    max-width: 100%;
}

.tx-section {
    max-width: 900px;
}

.swap-pagination {
    text-align: center;
    padding: .8rem 0;
}

.page-btn {
    padding: .3rem .9rem;
    font-size: .85rem;
    background-color: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: rgba(255, 255, 255, 0.7);
    cursor: pointer;
    margin: 0 .3rem;
}

.page-btn:hover {
    background-color: rgba(255, 255, 255, 0.15);
    color: white;
}

/* Login page */
.login-container {
    max-width: 340px;
    margin: 60px auto;
    padding: 1.2rem 1.5rem;
    background: linear-gradient(135deg, rgba(255,255,255,0.04) 0%, rgba(255,255,255,0.02) 100%);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 6px;
}

.login-container h2 {
    margin: 0 0 1rem;
    text-align: center;
    font-family: 'JetBrains Mono', monospace;
    font-size: .75rem;
    font-weight: 600;
    color: rgba(255,255,255,0.4);
    text-transform: uppercase;
    letter-spacing: .1em;
}

.login-container label {
    display: block;
    margin-bottom: .2rem;
    font-family: 'JetBrains Mono', monospace;
    font-size: .6rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.35);
    text-transform: uppercase;
    letter-spacing: .04em;
}

.login-container input[type="text"],
.login-container input[type="password"] {
    width: 100%;
    padding: 5px 8px;
    margin-bottom: .8rem;
    background: rgba(0, 0, 0, 0.25);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    color: white;
    font-family: 'JetBrains Mono', monospace;
    font-size: .78rem;
    box-sizing: border-box;
}

.login-container input:focus {
    outline: none;
    border-color: rgba(107,158,255,0.5);
}

.login-container button {
    width: 100%;
    padding: .4rem;
    background: rgba(74,122,223,0.2);
    border: 1px solid rgba(74,122,223,0.5);
    border-radius: 4px;
    color: #6b9eff;
    font-size: .78rem;
    font-weight: 600;
    cursor: pointer;
    transition: background .15s, color .15s;
}

.login-container button:hover {
    background: #4a7adf;
    color: #fff;
}

.login-container .error {
    background: rgba(248,113,113,0.08);
    border: 1px solid rgba(248,113,113,0.25);
    color: #f87171;
    padding: .4rem .6rem;
    border-radius: 4px;
    margin-bottom: .8rem;
    font-size: .78rem;
}

/* Users page */
.card {
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 6px;
    padding: .8rem 1rem;
    margin-bottom: .75rem;
    max-width: 1000px;
    width: 100%;
    background: linear-gradient(135deg, rgba(255,255,255,0.03) 0%, rgba(255,255,255,0.01) 100%);
}

.card h3 {
    margin: 0 0 .6rem 0;
    font-family: 'JetBrains Mono', monospace;
    font-size: .65rem;
    font-weight: 600;
    color: rgba(255,255,255,0.35);
    text-transform: uppercase;
    letter-spacing: .06em;
}

.card table {
    width: 100%;
    border-collapse: collapse;
}

.card table th,
.card table td {
    padding: 5px 8px;
    text-align: left;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
    white-space: nowrap;
    vertical-align: middle;
}

.card table th {
    font-family: 'JetBrains Mono', monospace;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.35);
    font-size: .62rem;
    text-transform: uppercase;
    letter-spacing: .06em;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.card table td {
    font-size: .78rem;
}

.card table td.ts {
    white-space: nowrap;
    font-family: 'JetBrains Mono', monospace;
    font-size: .7rem;
    color: rgba(255, 255, 255, 0.4);
}

.users-create-form {
    display: flex;
    gap: .5rem;
    align-items: flex-end;
    flex-wrap: wrap;
}

.users-create-form label {
    font-family: 'JetBrains Mono', monospace;
    font-size: .6rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.35);
    text-transform: uppercase;
    letter-spacing: .04em;
    display: block;
    margin-bottom: .15rem;
}

.users-create-form input {
    padding: 4px 8px;
    background: rgba(0, 0, 0, 0.25);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    color: white;
    font-family: 'JetBrains Mono', monospace;
    font-size: .78rem;
    min-width: 130px;
}

.users-create-form input:focus {
    outline: none;
    border-color: rgba(107,158,255,0.5);
}

.users-create-form button {
    padding: .25rem .6rem;
    background: rgba(74,122,223,0.2);
    border: 1px solid rgba(74,122,223,0.5);
    border-radius: 4px;
    color: #6b9eff;
    font-size: .78rem;
    font-weight: 600;
    cursor: pointer;
    transition: background .15s, color .15s;
}

.users-create-form button:hover {
    background: #4a7adf;
    color: #fff;
}

.card table td:last-child {
    white-space: nowrap;
}

.user-action-btn {
    padding: .25rem .6rem;
    font-size: .8rem;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 3px;
    color: rgba(255, 255, 255, 0.7);
    cursor: pointer;
    margin-right: .3rem;
}

.user-action-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    color: white;
}

.user-action-btn.danger {
    border-color: rgba(255, 80, 80, 0.3);
    color: #ff6b6b;
}

.user-action-btn.danger:hover {
    background: rgba(255, 80, 80, 0.15);
}

.badge-active {
    background: rgba(80, 200, 120, 0.15);
    color: #50c878;
}

.badge-blocked {
    background: rgba(255, 80, 80, 0.15);
    color: #ff6b6b;
}

dialog::backdrop {
    background: rgba(0, 0, 0, 0.6);
}

.pos-strategy-breakdown, .pos-signal-info {
    margin-top: .6rem;
    padding-top: .6rem;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.pos-strategy-breakdown > .pos-stat-label,
.pos-signal-info > .pos-stat-label {
    display: block;
    margin-bottom: .4rem;
}

.strat-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .3rem .6rem;
    padding: .25rem 0;
    font-size: .82rem;
}

.strat-detail {
    color: rgba(255, 255, 255, 0.6);
    font-size: .8rem;
}

.profit-pos {
    color: #4ade80;
    font-family: 'JetBrains Mono', monospace;
    font-weight: 700;
}

.profit-neg {
    color: #f87171;
    font-family: 'JetBrains Mono', monospace;
    font-weight: 700;
}

/* Jobs page */
.jobs-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: .6rem;
    max-width: 1200px;
    width: 100%;
}

.job-card {
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 6px;
    padding: .6rem .8rem;
    background: linear-gradient(135deg, rgba(255,255,255,0.03) 0%, rgba(255,255,255,0.01) 100%);
}

.job-card h3 {
    margin: 0 0 .5rem 0;
    font-family: 'JetBrains Mono', monospace;
    font-size: .72rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: .4rem;
}

.job-meta {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: .2rem .6rem;
    font-size: .72rem;
}

.job-meta dt {
    font-family: 'JetBrains Mono', monospace;
    font-size: .6rem;
    color: rgba(255, 255, 255, 0.35);
    text-transform: uppercase;
    letter-spacing: .04em;
}

.job-meta dd {
    margin: 0;
    font-family: 'JetBrains Mono', monospace;
    font-size: .72rem;
}

.job-meta dd.positive {
    color: #4ade80;
}

.job-meta dd.negative {
    color: #f87171;
}

.job-meta dd.warning {
    color: #fbbf24;
}

.status-dot {
    display: inline-block;
    width: 7px;
    height: 7px;
    border-radius: 50%;
}

.status-dot.running {
    background: #4ade80;
    box-shadow: 0 0 6px rgba(74,222,128,0.5);
    animation: pulse-dot 2s ease-in-out infinite;
}

.status-dot.stopped {
    background: #ef4444;
}

.job-status-msg {
    color: rgba(107,158,255,0.7);
    font-style: italic;
    font-size: .7rem;
}

.help-bubble {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: rgba(255,255,255,0.12);
    color: rgba(255,255,255,0.5);
    font-size: .7rem;
    font-weight: 700;
    cursor: help;
    position: relative;
    vertical-align: middle;
    margin-left: 4px;
}
.help-bubble:hover {
    background: rgba(255,255,255,0.25);
    color: #fff;
}
.help-bubble:hover::after {
    content: attr(title);
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
    background: #1a1a2e;
    color: rgba(255,255,255,0.85);
    border: 1px solid rgba(255,255,255,0.15);
    border-radius: 6px;
    padding: 8px 10px;
    font-size: .78rem;
    font-weight: 400;
    line-height: 1.4;
    width: 280px;
    white-space: normal;
    z-index: 100;
    pointer-events: none;
    box-shadow: 0 4px 12px rgba(0,0,0,0.4);
}
.help-bubble:hover::before {
    content: "";
    position: absolute;
    bottom: calc(100% + 2px);
    left: 50%;
    transform: translateX(-50%);
    border: 6px solid transparent;
    border-top-color: rgba(255,255,255,0.15);
    z-index: 101;
    pointer-events: none;
}

.toggle {
    position: relative;
    display: inline-block;
    width: 36px;
    height: 20px;
    vertical-align: middle;
}
.toggle input {
    opacity: 0;
    width: 0;
    height: 0;
}
.toggle-slider {
    position: absolute;
    inset: 0;
    background: rgba(255,255,255,0.15);
    border-radius: 20px;
    cursor: pointer;
    transition: background .2s;
}
.toggle-slider::before {
    content: "";
    position: absolute;
    width: 14px;
    height: 14px;
    left: 3px;
    bottom: 3px;
    background: #fff;
    border-radius: 50%;
    transition: transform .2s;
}
.toggle input:checked + .toggle-slider {
    background: #4caf50;
}
.toggle input:checked + .toggle-slider::before {
    transform: translateX(16px);
}
.mm-toggle {
    margin-left: auto;
}
.mm-toggle-label {
    font-size: .75rem;
    color: rgba(255,255,255,0.4);
    vertical-align: middle;
    margin-left: .25rem;
}

.section-header {
    display: flex;
    align-items: center;
    gap: .5rem;
}
.section-header h2 { margin: 0; }

/* Overview page */
.overview-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: .6rem;
    max-width: 1200px;
    width: 100%;
    margin-bottom: .75rem;
}

.stat-card {
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 6px;
    padding: .6rem .8rem;
    background: linear-gradient(135deg, rgba(255,255,255,0.03) 0%, rgba(255,255,255,0.01) 100%);
    text-align: center;
}

.stat-card .stat-label {
    font-family: 'JetBrains Mono', monospace;
    font-size: .6rem;
    color: rgba(255, 255, 255, 0.35);
    text-transform: uppercase;
    font-weight: 600;
    letter-spacing: .06em;
    margin-bottom: .25rem;
}

.stat-card .stat-value {
    font-family: 'JetBrains Mono', monospace;
    font-size: .95rem;
    font-weight: 700;
}

.stat-card .stat-value.positive {
    color: #4ade80;
}

.stat-card .stat-value.negative {
    color: #f87171;
}

.stat-card .stat-value.neutral {
    color: rgba(255, 255, 255, 0.8);
}

.stat-card .stat-detail {
    font-family: 'JetBrains Mono', monospace;
    font-size: .62rem;
    color: rgba(255, 255, 255, 0.3);
    margin-top: .2rem;
}

.stat-card .stat-detail .positive {
    color: #4ade80;
}

.stat-card .stat-detail .negative {
    color: #f87171;
}

.overview-section {
    max-width: 1200px;
    width: 100%;
    margin-bottom: .75rem;
}

.overview-section h2 {
    font-family: 'JetBrains Mono', monospace;
    font-size: .65rem;
    font-weight: 600;
    color: rgba(255,255,255,0.35);
    text-transform: uppercase;
    letter-spacing: .06em;
    margin: 0 0 .5rem 0;
}

/* Bet buttons */
.mc-bet-row {
    display: flex;
    gap: .5rem;
    justify-content: center;
    padding-top: .2rem;
}

.bet-btn {
    padding: .3rem .8rem;
    font-size: .8rem;
    font-weight: 700;
    cursor: pointer;
    border-radius: .4rem;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: white;
}

.bet-btn:hover {
    background: rgba(255, 255, 255, 0.15);
}

.bet-btn.yes {
    background: rgba(107, 196, 107, 0.15);
    border-color: #6bc46b;
    color: #e0ffe0;
}

.bet-btn.yes:hover {
    background: rgba(107, 196, 107, 0.3);
    color: white;
}

.bet-btn.no {
    background: rgba(232, 113, 113, 0.15);
    border-color: #e87171;
    color: #ffe0e0;
}

.bet-btn.no:hover {
    background: rgba(232, 113, 113, 0.3);
    color: white;
}

.bet-btn.sell {
    background: rgba(232, 113, 113, 0.1);
    border-color: #e87171;
    color: #ffe0e0;
}

.bet-btn.sell:hover {
    background: rgba(232, 113, 113, 0.25);
    color: white;
}

.pos-actions {
    margin-top: .6rem;
    display: flex;
    gap: .5rem;
}

/* Bet modal */
.bet-modal {
    background: #152d4a;
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: .8rem;
    padding: 0;
    width: 380px;
    max-width: 90vw;
}

.bet-modal-content {
    padding: 1.5rem;
}

.bet-modal-inner {
    padding: 1.5rem;
}

.strat-input {
    width: 3.5rem;
    padding: .15rem .3rem;
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.15);
    border-radius: 4px;
    color: #fff;
    font-size: .85rem;
    text-align: right;
    -moz-appearance: textfield;
}
.strat-input::-webkit-inner-spin-button,
.strat-input::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.bet-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.2rem;
}

.bet-modal-header h3 {
    margin: 0;
    font-size: 1.05rem;
}

.bet-modal-close {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.5);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0 .3rem;
}

.bet-modal-close:hover {
    color: white;
}

.bet-field {
    margin-bottom: 1rem;
}

.bet-field label {
    display: block;
    font-size: .82rem;
    color: rgba(255, 255, 255, 0.6);
    margin-bottom: .3rem;
    font-weight: 600;
}

.bet-field input[type="number"] {
    width: 100%;
    padding: .5rem .7rem;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: .4rem;
    color: white;
    font-size: .95rem;
}

.bet-field input[type="number"]:focus {
    outline: none;
    border-color: #2a7de1;
}

.bet-side-toggle {
    display: flex;
    gap: 0;
    border-radius: .4rem;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.side-btn {
    flex: 1;
    padding: .45rem;
    font-size: .9rem;
    font-weight: 700;
    cursor: pointer;
    background: rgba(255, 255, 255, 0.04);
    border: none;
    border-radius: 0;
    color: rgba(255, 255, 255, 0.5);
}

.side-btn.active[data-side="BUY"] {
    background: rgba(107, 196, 107, 0.2);
    color: #6bc46b;
}

.side-btn.active[data-side="SELL"] {
    background: rgba(232, 113, 113, 0.2);
    color: #e87171;
}

.bet-breakdown {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: .5rem;
    padding: .8rem 1rem;
    margin-bottom: 1rem;
}

.bet-bd-row {
    display: flex;
    justify-content: space-between;
    font-size: .88rem;
    padding: .2rem 0;
    color: rgba(255, 255, 255, 0.7);
}

.bet-bd-profit {
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    margin-top: .3rem;
    padding-top: .5rem;
    font-weight: 700;
}

.bet-submit {
    width: 100%;
    padding: .6rem;
    font-size: .95rem;
    font-weight: 700;
    background: rgba(42, 125, 225, 0.2);
    border: 1px solid #2a7de1;
    color: #2a7de1;
    cursor: pointer;
    border-radius: .5rem;
}

.bet-submit:hover {
    background: #2a7de1;
    color: white;
}

.bet-submit[disabled] {
    opacity: 0.5;
    cursor: wait;
}

#bet-result {
    margin-bottom: .8rem;
}

/* ── Market Making ─────────────────────────────────────── */
.btn-primary {
    background-color: rgba(74,122,223,0.2);
    border-color: rgba(74,122,223,0.5);
    color: #6b9eff;
    cursor: pointer;
    transition: background .15s, color .15s;
}
.btn-primary:hover { background-color: #4a7adf; color: #fff; }

.btn-danger {
    background-color: rgba(225,83,83,0.15);
    border-color: rgba(225,83,83,0.4);
    color: #ff7b7b;
    cursor: pointer;
    transition: background .15s, color .15s;
}
.btn-danger:hover { background-color: #e15353; color: #fff; }

.btn-sm {
    padding: .2rem .45rem;
    font-size: .72rem;
    font-weight: 600;
    letter-spacing: .02em;
}

/* ── MM Page Layout ── */
.mm-controls-wrap {
    width: 100%;
    max-width: 1400px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 10px;
}

/* ── MM Toolbar ── */
.mm-toolbar {
    display: flex;
    align-items: center;
    gap: 0;
    position: relative;
    flex-wrap: wrap;
    padding: 0;
    background: linear-gradient(135deg, rgba(255,255,255,0.04) 0%, rgba(255,255,255,0.02) 100%);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 6px;
    font-size: .8rem;
    overflow: visible;
}
.mm-toolbar-group {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-right: 1px solid rgba(255,255,255,0.06);
}
.mm-toolbar-group:last-child {
    border-right: none;
}
.mm-toolbar-label {
    font-family: 'JetBrains Mono', monospace;
    font-size: .6rem;
    text-transform: uppercase;
    font-weight: 600;
    color: rgba(255,255,255,0.3);
    letter-spacing: .08em;
}
.mm-status-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    display: inline-block;
    flex-shrink: 0;
}
.mm-status-dot.on {
    background: #4ade80;
    box-shadow: 0 0 6px rgba(74,222,128,0.5);
    animation: pulse-dot 2s ease-in-out infinite;
}
@keyframes pulse-dot {
    0%, 100% { box-shadow: 0 0 6px rgba(74,222,128,0.5); }
    50% { box-shadow: 0 0 10px rgba(74,222,128,0.8); }
}
.mm-status-dot.off { background: #ef4444; }
.mm-toolbar-search {
    flex: 1;
    min-width: 180px;
}
.mm-toolbar-input {
    width: 100%;
    padding: 4px 8px;
    background: rgba(0,0,0,0.2);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 4px;
    color: white;
    font-size: .78rem;
    transition: border-color .15s;
}
.mm-toolbar-input:focus {
    outline: none;
    border-color: rgba(107,158,255,0.4);
}
.mm-toolbar-input::placeholder {
    color: rgba(255,255,255,0.25);
}

/* ── MM Config Panel ── */
.mm-config-panel {
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 6px;
    background: linear-gradient(135deg, rgba(255,255,255,0.03) 0%, rgba(255,255,255,0.01) 100%);
}
.mm-config-panel summary {
    padding: 5px 12px;
    font-family: 'JetBrains Mono', monospace;
    font-size: .65rem;
    font-weight: 600;
    color: rgba(255,255,255,0.35);
    cursor: pointer;
    user-select: none;
    list-style: none;
    letter-spacing: .06em;
    text-transform: uppercase;
    transition: color .15s;
}
.mm-config-panel summary::before {
    content: "\25B8 ";
    font-size: .55rem;
    transition: transform .2s cubic-bezier(.4,0,.2,1);
    display: inline-block;
    margin-right: 4px;
}
.mm-config-panel[open] > summary::before {
    transform: rotate(90deg);
}
.mm-config-panel summary::-webkit-details-marker { display: none; }
.mm-config-panel summary:hover {
    color: rgba(255,255,255,0.7);
}
.mm-config-panel[open] > summary {
    border-bottom: 1px solid rgba(255,255,255,0.05);
}
.mm-config-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 2px 0;
    padding: 6px 8px;
    align-items: center;
}
.mm-cfg-field {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    cursor: help;
    border-radius: 3px;
    transition: background .12s;
}
.mm-cfg-field:hover {
    background: rgba(255,255,255,0.04);
}
.mm-cfg-label {
    font-family: 'JetBrains Mono', monospace;
    font-size: .6rem;
    color: rgba(255,255,255,0.38);
    font-weight: 500;
    text-transform: uppercase;
    white-space: nowrap;
    letter-spacing: .04em;
}
.mm-config-form { margin-bottom: 0; }
.mm-config-actions {
    padding: 4px 12px 8px;
    display: flex;
    gap: 6px;
}

/* ── MM Search Results ── */
.mm-search-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: .6rem;
    max-height: 480px;
    overflow-y: auto;
    padding: .4rem 0 .6rem 0;
}
.mm-search-cards::-webkit-scrollbar { width: 4px; }
.mm-search-cards::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.15);
    border-radius: 2px;
}
.mm-search-cards > .load-more,
.mm-search-cards > .end-msg { grid-column: 1 / -1; }
.btn-added { opacity: 0.4; cursor: default; }

/* ── CB Toggle Switch ── */
.mm-cb-wrap { display: inline-flex; align-items: center; gap: 6px; padding: 2px 8px; }
.mm-toggle { position: relative; width: 28px; height: 14px; flex-shrink: 0; }
.mm-toggle input { opacity: 0; width: 0; height: 0; }
.mm-toggle-slider {
    position: absolute; inset: 0; background: rgba(255,255,255,0.1); border-radius: 7px;
    cursor: pointer; transition: background .2s;
}
.mm-toggle-slider::before {
    content: ''; position: absolute; left: 2px; top: 2px; width: 10px; height: 10px;
    background: rgba(255,255,255,0.4); border-radius: 50%; transition: transform .2s, background .2s;
}
.mm-toggle input:checked + .mm-toggle-slider { background: rgba(107,158,255,0.3); }
.mm-toggle input:checked + .mm-toggle-slider::before { transform: translateX(14px); background: #6b9eff; }
.mm-cb-off .mm-cfg-field { opacity: 0.3; pointer-events: none; }

/* ── MM Inputs ── */
.mm-input {
    width: 4rem;
    padding: 2px 5px;
    background: rgba(0,0,0,0.25);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 3px;
    color: #e2e8f0;
    font-family: 'JetBrains Mono', monospace;
    font-size: .7rem;
    text-align: right;
    transition: border-color .15s;
}
.mm-input:focus {
    outline: none;
    border-color: rgba(107,158,255,0.5);
    background: rgba(0,0,0,0.35);
}

.mm-add-form input {
    padding: .35rem .5rem;
    background: rgba(0,0,0,0.2);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 4px;
    color: white;
    font-size: .82rem;
}
.mm-add-form label {
    display: block;
    font-size: .7rem;
    color: rgba(255,255,255,0.4);
    margin-bottom: .15rem;
}

/* ── Balance Warning ── */
.balance-warning {
    background: rgba(251,146,60,0.08);
    border: 1px solid rgba(251,146,60,0.25);
    border-left: 3px solid #fb923c;
    border-radius: 4px;
    color: #fdba74;
    padding: 8px 12px;
    margin: 6px 0;
    font-size: .78rem;
    line-height: 1.5;
}

/* ── MM Inline Table Inputs ── */
.mm-inline-input {
    background: rgba(0,0,0,0.2);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 3px;
    color: #e2e8f0;
    font-family: 'JetBrains Mono', monospace;
    font-size: .72rem;
    padding: 2px 5px;
    width: 4.2rem;
    text-align: right;
    transition: border-color .15s, background .15s;
}
.mm-inline-input:focus {
    outline: none;
    border-color: rgba(107,158,255,0.5);
    background: rgba(0,0,0,0.35);
}
.mm-inline-input::placeholder {
    color: rgba(255,255,255,0.2);
    font-style: italic;
}

/* ── MM Table Overrides ── */
.mm-table {
    border-collapse: separate;
    border-spacing: 0;
    width: 100%;
    max-width: 1400px;
    font-size: .78rem;
}
.mm-table thead th {
    font-family: 'JetBrains Mono', monospace;
    font-size: .62rem;
    font-weight: 600;
    color: rgba(255,255,255,0.35);
    text-transform: uppercase;
    letter-spacing: .06em;
    padding: 6px 8px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    white-space: nowrap;
    position: sticky;
    top: 0;
    background: #0d263f;
    text-align: left;
}
.mm-table tbody td {
    padding: 5px 8px;
    border-bottom: 1px solid rgba(255,255,255,0.04);
    white-space: nowrap;
    vertical-align: middle;
}
.mm-table tbody tr {
    transition: background .1s;
}
.mm-table tbody tr:hover {
    background: rgba(255,255,255,0.03);
}
.mm-table .col-market {
    max-width: 180px;
    overflow: hidden;
    text-overflow: ellipsis;
    font-weight: 500;
    color: rgba(255,255,255,0.8);
    font-size: .76rem;
}
.mm-table .col-market a {
    color: inherit;
    text-decoration: none;
}
.mm-table .col-market a:hover {
    color: #fff;
    text-decoration: underline;
}
.mm-table .col-id {
    font-family: 'JetBrains Mono', monospace;
    font-size: .65rem;
    color: rgba(255,255,255,0.3);
}
.mm-table .col-price {
    font-family: 'JetBrains Mono', monospace;
    font-size: .72rem;
    font-weight: 500;
}
.mm-table .col-price.yes { color: #4ade80; }
.mm-table .col-price.no { color: #f87171; }
.mm-table .col-price.dim { color: rgba(255,255,255,0.2); }
.mm-table .col-inv {
    font-family: 'JetBrains Mono', monospace;
    font-size: .72rem;
    font-weight: 500;
    color: rgba(255,255,255,0.7);
}
.mm-table .col-actions {
    display: flex;
    gap: 4px;
    align-items: center;
}
.mm-table .col-status .badge {
    font-family: 'JetBrains Mono', monospace;
    font-size: .6rem;
    font-weight: 700;
    letter-spacing: .04em;
    padding: 2px 6px;
    text-transform: uppercase;
}

/* ── Collapsible market detail rows ── */
.mm-table .col-caret {
    width: 18px;
    padding: 5px 2px 5px 8px !important;
    cursor: pointer;
    user-select: none;
}
.mm-table .caret {
    display: inline-block;
    font-size: .55rem;
    color: rgba(255,255,255,0.3);
    transition: transform .15s, color .15s;
}
.mm-table .caret:hover {
    color: rgba(255,255,255,0.6);
}
.mm-table .caret.open {
    transform: rotate(90deg);
    color: rgba(255,255,255,0.5);
}
.mm-detail-row {
    display: none;
}
.mm-detail-row.show {
    display: table-row;
}
.mm-detail-row:hover {
    background: none !important;
}
.mm-detail-cell {
    padding: 4px 8px 8px 8px !important;
    border-bottom: 1px solid rgba(255,255,255,0.08) !important;
}
.mm-detail-cell label {
    font-family: 'JetBrains Mono', monospace;
    font-size: .62rem;
    font-weight: 600;
    color: rgba(255,255,255,0.35);
    text-transform: uppercase;
    letter-spacing: .04em;
    margin-right: 14px;
}
.mm-detail-cell .mm-inline-input {
    margin-left: 4px;
}

/* ── WS Status (compact) ── */
.ws-tag {
    font-family: 'JetBrains Mono', monospace;
    font-size: .65rem;
    font-weight: 500;
    padding: 1px 5px;
    border-radius: 3px;
    letter-spacing: .02em;
}
.ws-tag.ok { background: rgba(74,222,128,0.12); color: #4ade80; }
.ws-tag.err { background: rgba(248,113,113,0.12); color: #f87171; }

/* ── Tooltip question mark ── */
.tt {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 12px;
    height: 12px;
    font-size: 8px;
    font-weight: 700;
    line-height: 1;
    border-radius: 50%;
    background: rgba(255,255,255,0.08);
    color: rgba(255,255,255,0.35);
    cursor: help;
    margin-left: 3px;
    vertical-align: middle;
    position: relative;
    transition: color .12s, background .12s;
}
.tt:hover {
    background: rgba(255,255,255,0.2);
    color: rgba(255,255,255,0.9);
}
.tt:hover::after {
    content: attr(title);
    position: absolute;
    bottom: calc(100% + 6px);
    left: 50%;
    transform: translateX(-50%);
    background: #132d4a;
    color: rgba(255,255,255,0.88);
    font-family: 'Nunito Sans', sans-serif;
    font-size: 11px;
    font-weight: 400;
    padding: 6px 10px;
    border-radius: 4px;
    white-space: normal;
    width: max-content;
    max-width: 240px;
    z-index: 100;
    box-shadow: 0 4px 16px rgba(0,0,0,0.4);
    border: 1px solid rgba(255,255,255,0.08);
    pointer-events: none;
    line-height: 1.4;
}
.tt:hover::before {
    content: '';
    position: absolute;
    bottom: calc(100% + 2px);
    left: 50%;
    transform: translateX(-50%);
    border: 4px solid transparent;
    border-top-color: #132d4a;
    z-index: 100;
    pointer-events: none;
}

/* ── MM Grouped Orders/Positions ── */
.mm-group {
    margin-bottom: 2px;
}
.mm-group:last-child {
    margin-bottom: 0;
}
.mm-group-header {
    font-family: 'JetBrains Mono', monospace;
    font-size: .62rem;
    font-weight: 600;
    color: rgba(255,255,255,0.5);
    text-transform: uppercase;
    letter-spacing: .05em;
    padding: 6px 12px 3px;
    border-bottom: 1px solid rgba(255,255,255,0.06);
    background: rgba(255,255,255,0.02);
}
.mm-group-table {
    border-collapse: separate;
    border-spacing: 0;
    width: 100%;
    font-size: .76rem;
}
.mm-group-table thead th {
    font-family: 'JetBrains Mono', monospace;
    font-size: .58rem;
    font-weight: 600;
    color: rgba(255,255,255,0.28);
    text-transform: uppercase;
    letter-spacing: .05em;
    padding: 4px 10px;
    text-align: left;
    border-bottom: 1px solid rgba(255,255,255,0.05);
}
.mm-group-table tbody td {
    padding: 3px 10px;
    border-bottom: 1px solid rgba(255,255,255,0.03);
    white-space: nowrap;
    vertical-align: middle;
}
.mm-group-table tbody tr:hover {
    background: rgba(255,255,255,0.025);
}
.mm-group-table .col-market {
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: .74rem;
    color: rgba(255,255,255,0.7);
}
.mm-group-table .col-price {
    font-family: 'JetBrains Mono', monospace;
    font-size: .7rem;
    font-weight: 500;
    color: rgba(255,255,255,0.8);
}
.mm-group-table .col-inv {
    font-family: 'JetBrains Mono', monospace;
    font-size: .7rem;
    font-weight: 500;
    color: rgba(255,255,255,0.7);
}
.mm-group-table .badge {
    font-family: 'JetBrains Mono', monospace;
    font-size: .58rem;
    font-weight: 600;
    letter-spacing: .03em;
    padding: 1px 5px;
}

/* ── MM Logs Panel ── */
.mm-logs-controls {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 12px;
    border-bottom: 1px solid rgba(255,255,255,0.05);
}
.mm-logs-toggle {
    display: flex;
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 4px;
    overflow: hidden;
}
.mm-log-mode {
    padding: 3px 12px;
    font-family: 'JetBrains Mono', monospace;
    font-size: .6rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .06em;
    background: transparent;
    border: none;
    border-radius: 0;
    color: rgba(255,255,255,0.35);
    cursor: pointer;
    transition: color .12s, background .12s;
}
.mm-log-mode:hover {
    color: rgba(255,255,255,0.6);
    background: rgba(255,255,255,0.04);
}
.mm-log-mode.active {
    background: rgba(107,158,255,0.15);
    color: #6b9eff;
}
.mm-log-mode + .mm-log-mode {
    border-left: 1px solid rgba(255,255,255,0.1);
}
.mm-logs-hint {
    font-family: 'JetBrains Mono', monospace;
    font-size: .55rem;
    color: rgba(255,255,255,0.2);
    letter-spacing: .04em;
}
.mm-scroll-on { color: rgba(80,200,120,0.5); }
.mm-scroll-off { color: rgba(255,255,255,0.15); }
.mm-logs-container {
    max-height: 260px;
    overflow-y: auto;
    padding: 4px 0;
    display: flex;
    flex-direction: column;
}
.mm-logs-container::-webkit-scrollbar { width: 5px; }
.mm-logs-container::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.2);
    border-radius: 2px;
}
.mm-logs-container::-webkit-scrollbar-thumb:hover {
    background: rgba(255,255,255,0.35);
}
.mm-fills-container {
    max-height: 400px;
    overflow-y: auto;
}
.mm-fills-container::-webkit-scrollbar { width: 5px; }
.mm-fills-container::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.2);
    border-radius: 2px;
}
.mm-fills-container::-webkit-scrollbar-thumb:hover {
    background: rgba(255,255,255,0.35);
}
.mm-log-line {
    font-family: 'JetBrains Mono', monospace;
    font-size: .62rem;
    line-height: 1.6;
    padding: 0 12px;
    color: rgba(255,255,255,0.55);
    white-space: pre-wrap;
    word-break: break-all;
    border-left: 2px solid transparent;
    transition: background .1s;
}
.mm-log-line:hover {
    background: rgba(255,255,255,0.025);
}
.mm-log-line.mm-log-err {
    color: #f87171;
    border-left-color: #f87171;
    background: rgba(248,113,113,0.04);
}
.mm-log-line.mm-log-warn {
    color: #fbbf24;
    border-left-color: #fbbf24;
    background: rgba(251,191,36,0.03);
}
.mm-log-line.mm-log-order {
    color: #6b9eff;
    border-left-color: rgba(107,158,255,0.4);
}
.mm-log-line.mm-log-fill {
    color: #4ade80;
    border-left-color: #4ade80;
    background: rgba(74,222,128,0.04);
    font-weight: 600;
}
.mm-log-line.mm-log-merge {
    color: #c084fc;
    border-left-color: #c084fc;
    background: rgba(192,132,252,0.04);
}
.mm-log-line.mm-log-dim {
    color: rgba(255,255,255,0.25);
}
.mm-log-ts {
    color: rgba(255,255,255,0.18);
}

/* ── MM Search Results Dropdown ── */
#mm-search-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    z-index: 100;
}
#mm-search-results:empty { display: none; }

/* ── MM Event Search Results ── */
.mm-search-event, .mm-search-list {
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 6px;
    background: rgba(15,18,25,0.97);
    margin-top: 4px;
    overflow: hidden;
    box-shadow: 0 8px 24px rgba(0,0,0,0.4);
    max-height: 500px;
    overflow-y: auto;
}
.mm-event-header {
    padding: 10px 14px;
    border-bottom: 1px solid rgba(255,255,255,0.06);
}
.mm-event-header h4 {
    margin: 0;
    font-size: .82rem;
    font-weight: 600;
    color: rgba(255,255,255,0.85);
}
.mm-event-hint {
    font-size: .65rem;
    color: rgba(255,255,255,0.3);
    letter-spacing: .02em;
}
.mm-event-markets {
    max-height: 420px;
    overflow-y: auto;
}
.mm-event-markets::-webkit-scrollbar { width: 4px; }
.mm-event-markets::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.12); border-radius: 2px; }
.mm-search-list::-webkit-scrollbar { width: 4px; }
.mm-search-list::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.12); border-radius: 2px; }
.mm-event-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 7px 14px;
    cursor: pointer;
    transition: background .1s;
    border-bottom: 1px solid rgba(255,255,255,0.03);
}
.mm-event-row:hover { background: rgba(255,255,255,0.03); }
.mm-event-row:last-child { border-bottom: none; }
.mm-event-cb {
    flex-shrink: 0;
    width: 15px;
    height: 15px;
    accent-color: #6b9eff;
}
.mm-event-q {
    flex: 1;
    font-size: .75rem;
    color: rgba(255,255,255,0.75);
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.mm-event-prices {
    flex-shrink: 0;
    font-family: 'JetBrains Mono', monospace;
    font-size: .62rem;
    color: rgba(255,255,255,0.35);
    letter-spacing: .02em;
}
.mm-event-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    padding: 8px 14px;
    border-top: 1px solid rgba(255,255,255,0.1);
    background: rgba(15,18,25,0.97);
    position: sticky;
    bottom: 0;
    z-index: 1;
}
