@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');

* {
    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: 2rem;
    min-height: calc(100vh - 60px);
}

main>h1 {
    padding-bottom: 1rem;
}

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

.market-card {
    display: flex;
    flex-direction: column;
    width: 260px;
    padding: 1.1rem 1.25rem;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: .6rem;
    gap: .7rem;
}

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

.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: .85rem;
    font-weight: 600;
    line-height: 1.3;
}

.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-weight: 700;
    font-size: .85rem;
}

.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: .5rem 1rem;
    background-color: transparent;
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: .5rem;
    font-size: 1rem;
}

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

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

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

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

nav {
    display: flex;
    gap: 1.5rem;
    padding: 1rem 2rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.15);
    align-items: center;
    overflow: visible;
    position: relative;
    z-index: 10;
}

#balance {
    margin-left: auto;
    font-weight: 700;
    color: #7ec87e;
    font-size: .95rem;
}

nav a {
    color: rgba(255, 255, 255, 0.7);
    text-decoration: none;
    font-weight: 600;
}

nav a:hover {
    color: white;
}

.orders-table {
    border-collapse: collapse;
    width: 95%;
    max-width: 1600px;
}

.market-col {
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: .85rem;
}
.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.2);
    color: #aac4ff;
    font-size: .75rem;
}

.orders-table th,
.orders-table td {
    padding: .6rem 1rem;
    text-align: left;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.orders-table th {
    font-weight: 700;
    color: rgba(255, 255, 255, 0.6);
    font-size: .85rem;
    text-transform: uppercase;
}

.badge {
    padding: .2rem .6rem;
    border-radius: .3rem;
    font-weight: 700;
    font-size: .85rem;
}

.cancel-btn {
    padding: .3rem .8rem;
    font-size: .85rem;
    background-color: transparent;
    border-color: #e15353;
    color: #e15353;
    cursor: pointer;
}

.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(420px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
    width: 95%;
    max-width: 1600px;
}

.position-card {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: .6rem;
    padding: 1rem 1.2rem;
}

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

.pos-question {
    font-weight: 600;
    font-size: .95rem;
    color: #e0e0e0;
    text-decoration: none;
    line-height: 1.3;
}

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

.pos-outcome {
    margin-bottom: .75rem;
    font-size: .9rem;
}

.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-size: .72rem;
    color: rgba(255, 255, 255, 0.45);
    text-transform: uppercase;
    letter-spacing: .03em;
}

.pos-stat-value {
    font-size: .9rem;
    font-weight: 600;
}

/* Filter bar */

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

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

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

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

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

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

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

.filter-check {
    padding: .5rem .8rem;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: .5rem;
    background-color: rgba(255, 255, 255, 0.05);
    font-size: .9rem;
    color: rgba(255, 255, 255, 0.7);
    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 1rem 0;
    font-size: .9rem;
    color: rgba(255, 255, 255, 0.6);
}

.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: 280px;
    padding: 1.1rem 1.25rem;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: .6rem;
    gap: .7rem;
    text-decoration: none;
    color: white;
    transition: border-color 0.15s;
}

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

.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: .85rem;
    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: 1.5rem;
    padding: 1.2rem 1.5rem;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: .6rem;
    margin-bottom: 1.5rem;
    max-width: 600px;
    width: 100%;
}

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

.wa-label {
    font-size: .78rem;
    color: rgba(255, 255, 255, 0.4);
    text-transform: uppercase;
    font-weight: 700;
}

.wa-addr {
    font-size: .82rem;
    word-break: break-all;
    color: rgba(255, 255, 255, 0.8);
}

.copy-btn {
    padding: .25rem .7rem;
    font-size: .78rem;
    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: 1rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    justify-content: center;
    max-width: 600px;
    width: 100%;
}

.wb-row {
    display: flex;
    align-items: center;
    gap: .5rem;
    padding: .8rem 1.2rem;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: .6rem;
    flex: 1;
    min-width: 140px;
}

.wb-token {
    font-weight: 700;
    font-size: .85rem;
    color: rgba(255, 255, 255, 0.6);
}

.wb-amount {
    font-weight: 700;
    font-size: .95rem;
    margin-left: auto;
}

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

.wallet-section h2 {
    font-size: 1.1rem;
    margin: 0 0 .75rem 0;
}

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

.wallet-form select,
.wallet-form input[type="text"] {
    padding: .5rem .8rem;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: .5rem;
    background-color: rgba(255, 255, 255, 0.05);
    color: white;
    font-size: .9rem;
    flex: 1;
    min-width: 120px;
}

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

.wallet-form button {
    padding: .5rem 1.2rem;
    font-weight: 700;
    background-color: rgba(42, 125, 225, 0.15);
    border-color: #2a7de1;
    color: #2a7de1;
    cursor: pointer;
}

.wallet-form button:hover {
    background-color: #2a7de1;
    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: 360px;
    margin: 80px auto;
    padding: 2rem;
    background-color: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
}

.login-container h2 {
    margin: 0 0 1.5rem;
    text-align: center;
    font-size: 1.4rem;
    color: white;
}

.login-container label {
    display: block;
    margin-bottom: .3rem;
    font-size: .85rem;
    color: rgba(255, 255, 255, 0.7);
}

.login-container input[type="text"],
.login-container input[type="password"] {
    width: 100%;
    padding: .5rem .6rem;
    margin-bottom: 1rem;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 4px;
    color: white;
    font-size: .9rem;
    box-sizing: border-box;
}

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

.login-container button {
    width: 100%;
    padding: .6rem;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 4px;
    color: white;
    font-size: .9rem;
    cursor: pointer;
}

.login-container button:hover {
    background: rgba(255, 255, 255, 0.18);
}

.login-container .error {
    background: rgba(255, 80, 80, 0.15);
    border: 1px solid rgba(255, 80, 80, 0.3);
    color: #ff6b6b;
    padding: .5rem .7rem;
    border-radius: 4px;
    margin-bottom: 1rem;
    font-size: .85rem;
}

/* Users page */
.card {
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: .6rem;
    padding: 1.5rem 2rem;
    margin-bottom: 1.5rem;
    max-width: 1000px;
    width: 100%;
    background: rgba(255, 255, 255, 0.02);
}

.card h3 {
    margin: 0 0 1.2rem 0;
    font-size: 1.1rem;
    font-weight: 700;
}

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

.card table th,
.card table td {
    padding: .6rem 1rem;
    text-align: left;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.card table th {
    font-weight: 700;
    color: rgba(255, 255, 255, 0.6);
    font-size: .82rem;
    text-transform: uppercase;
}

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

.card table td.ts {
    white-space: nowrap;
    font-size: .82rem;
    color: rgba(255, 255, 255, 0.6);
}

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

.users-create-form label {
    font-size: .8rem;
    color: rgba(255, 255, 255, 0.6);
    display: block;
    margin-bottom: .2rem;
}

.users-create-form input {
    padding: .45rem .6rem;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 4px;
    color: white;
    font-size: .85rem;
    min-width: 150px;
}

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

.users-create-form button {
    padding: .4rem .8rem;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 4px;
    color: white;
    font-size: .85rem;
    cursor: pointer;
}

.users-create-form button:hover {
    background: rgba(255, 255, 255, 0.18);
}

.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 {
    display: inline-block;
    padding: .15rem .5rem;
    border-radius: 3px;
    font-size: .75rem;
}

.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: #6bc46b;
    font-weight: 700;
}

.profit-neg {
    color: #e87171;
    font-weight: 700;
}

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

.job-card {
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: .6rem;
    padding: 1.2rem 1.5rem;
    background: rgba(255, 255, 255, 0.02);
}

.job-card h3 {
    margin: 0 0 .8rem 0;
    font-size: .95rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: .5rem;
}

.job-meta {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: .3rem .8rem;
    font-size: .82rem;
}

.job-meta dt {
    color: rgba(255, 255, 255, 0.5);
}

.job-meta dd {
    margin: 0;
}

.job-meta dd.positive {
    color: #6bc46b;
}

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

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

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

.status-dot.running {
    background: #6bc46b;
}

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

.job-status-msg {
    color: #7ec8e8;
    font-style: italic;
    font-size: .82rem;
}

.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);
}

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

.stat-card {
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: .6rem;
    padding: 1.2rem 1.5rem;
    background: rgba(255, 255, 255, 0.02);
    text-align: center;
}

.stat-card .stat-label {
    font-size: .78rem;
    color: rgba(255, 255, 255, 0.5);
    text-transform: uppercase;
    font-weight: 700;
    margin-bottom: .4rem;
}

.stat-card .stat-value {
    font-size: 1.4rem;
    font-weight: 700;
}

.stat-card .stat-value.positive {
    color: #6bc46b;
}

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

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

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

.overview-section h2 {
    font-size: 1.1rem;
    margin: 0 0 .75rem 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: #4a7adf;
    border-color: #4a7adf;
    cursor: pointer;
}
.btn-primary:hover { background-color: #3a6acf; }

.btn-danger {
    background-color: #e15353;
    border-color: #e15353;
    cursor: pointer;
}
.btn-danger:hover { background-color: #c04040; }

.btn-sm {
    padding: .25rem .5rem;
    font-size: .8rem;
}

.mm-config-form {
    margin-bottom: 1rem;
}

.mm-input {
    width: 6rem;
    padding: .3rem .5rem;
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.15);
    border-radius: .3rem;
    color: white;
    font-size: .9rem;
    text-align: right;
}

.mm-add-form input {
    padding: .4rem .6rem;
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.15);
    border-radius: .3rem;
    color: white;
    font-size: .9rem;
}

.mm-add-form label {
    display: block;
    font-size: .75rem;
    color: rgba(255,255,255,0.5);
    margin-bottom: .2rem;
}

/* Tooltip question mark */
.tt {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 14px;
    height: 14px;
    font-size: 10px;
    font-weight: 700;
    line-height: 1;
    border-radius: 50%;
    background: rgba(255,255,255,0.12);
    color: rgba(255,255,255,0.55);
    cursor: help;
    margin-left: 4px;
    vertical-align: middle;
    position: relative;
}

.tt:hover {
    background: rgba(255,255,255,0.25);
    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: #1a3a5c;
    color: rgba(255,255,255,0.92);
    font-size: 11px;
    font-weight: 400;
    padding: 6px 10px;
    border-radius: 4px;
    white-space: normal;
    width: max-content;
    max-width: 260px;
    z-index: 100;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
    border: 1px solid rgba(255,255,255,0.1);
    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: #1a3a5c;
    z-index: 100;
    pointer-events: none;
}
