/* Wallet page overrides and tab layout */

.wallet-hero .hero-metrics {
    min-width: 200px;
}

.wallet-search {
    display: flex;
    gap: 10px;
    align-items: center;
    margin-top: 20px;
    flex-wrap: wrap;
}

.wallet-search input {
    flex: 1;
    min-width: 280px;
    padding: 11px 14px;
    border-radius: 10px;
    border: 1px solid var(--panel-border);
    background: var(--bg-elevated);
    color: var(--ink);
    font-family: var(--font-mono);
    font-size: 0.88rem;
}

.wallet-search input::placeholder {
    color: var(--muted-2);
}

.address-error {
    margin-top: 8px;
    font-size: 0.86rem;
    color: var(--accent);
    min-height: 1.4em;
}

.wallet-layout {
    grid-template-columns: minmax(0, 1fr);
}

.wallet-panel {
    max-width: 100%;
}

.wallet-tabs {
    display: flex;
    gap: 4px;
    padding: 4px;
    background: var(--bg-elevated);
    border: 1px solid var(--panel-border);
    border-radius: 10px;
    width: fit-content;
}

.wallet-tabs [role="tab"] {
    padding: 8px 16px;
    border: 1px solid transparent;
    background: transparent;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.78rem;
    letter-spacing: 0.02em;
    cursor: pointer;
    color: var(--muted);
    transition:
        color 0.2s ease,
        background 0.2s ease,
        border-color 0.2s ease;
}

.wallet-tabs [role="tab"]:hover {
    color: var(--ink);
    background: rgba(255, 255, 255, 0.04);
}

.wallet-tabs [role="tab"][aria-selected="true"] {
    background: var(--hover);
    color: var(--ink);
    border-color: var(--panel-border-strong);
}

.wallet-tabpanel {
    padding-top: 8px;
}

.wallet-table {
    max-height: 420px;
}

.asset-cell {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
}

.asset-badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 8px;
    border-radius: 999px;
    font-size: 0.65rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    border: 1px solid rgba(255, 90, 31, 0.32);
    background: rgba(255, 90, 31, 0.16);
    color: var(--ink);
    font-weight: 700;
}

.trades-scroll {
    max-height: 480px;
}

.trades-header {
    flex-wrap: wrap;
    gap: 12px;
}

.trades-summary {
    font-size: 0.82rem;
    margin-top: 4px;
    white-space: pre-line;
}

.trades-controls {
    display: flex;
    align-items: center;
    gap: 10px;
}

.trades-controls .filter-toggle {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.trades-controls input[type="number"] {
    width: 4ch;
    padding: 6px 8px;
    border-radius: 8px;
    border: 1px solid var(--panel-border);
    font-weight: 600;
}

/* Direction pills (OPEN LONG / CLOSE LONG / Buy / Sell) */
.dir-pill {
    display: inline-block;
    padding: 3px 9px;
    border-radius: 999px;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.03em;
}

.dir-pill.long-open,
.dir-pill.buy {
    background: var(--profit-bg);
    color: var(--profit);
}

.dir-pill.short-open,
.dir-pill.sell {
    background: var(--loss-bg);
    color: var(--loss);
}

.dir-pill.neutral {
    background: rgba(127, 139, 154, 0.16);
    color: var(--muted);
}

/* Aggregate fills: type pill and time range */
.type-pill {
    display: inline-block;
    padding: 3px 9px;
    border-radius: 999px;
    font-size: 0.7rem;
    font-weight: 700;
    background: rgba(127, 139, 154, 0.16);
    color: var(--muted);
    border: 1px solid transparent;
}

.type-pill.twap {
    background: rgba(47, 120, 255, 0.16);
    color: #5aa2ff;
    border-color: rgba(47, 120, 255, 0.28);
}

.type-pill.fill {
    background: rgba(127, 139, 154, 0.14);
    color: var(--muted);
    border-color: rgba(127, 139, 154, 0.22);
}

.trades-time-cell {
    white-space: nowrap;
}

.trades-time-cell div + div {
    margin-top: 2px;
}

.trades-pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    padding: 12px 0 0;
    margin-top: 8px;
    border-top: 1px solid var(--panel-border);
}

.trades-page-info {
    font-size: 0.86rem;
    min-width: 6ch;
    text-align: center;
}

/* Holdings table: keep numbers right-aligned (including Value USD). */
#panel-holdings td:nth-child(2),
#panel-holdings td:nth-child(3),
#panel-holdings td:nth-child(4),
#panel-holdings td:nth-child(5),
#panel-holdings th:nth-child(2),
#panel-holdings th:nth-child(3),
#panel-holdings th:nth-child(4),
#panel-holdings th:nth-child(5) {
    text-align: right;
    font-family: var(--font-mono);
}

/* Trades table tweaks (market-flow-like: numbers in mono, right-aligned). */
#panel-trades .table-wrap table {
    font-family: var(--font-mono);
    font-size: 0.84rem;
}

#panel-trades td:nth-child(5),
#panel-trades td:nth-child(6),
#panel-trades td:nth-child(7),
#panel-trades td:nth-child(8),
#panel-trades td:nth-child(9),
#panel-trades th:nth-child(5),
#panel-trades th:nth-child(6),
#panel-trades th:nth-child(7),
#panel-trades th:nth-child(8),
#panel-trades th:nth-child(9) {
    text-align: right;
}

#panel-trades td:nth-child(3) {
    font-weight: 700;
    letter-spacing: 0.02em;
}

@media (max-width: 720px) {
    .wallet-search {
        flex-direction: column;
        align-items: stretch;
    }

    .wallet-search input {
        min-width: 0;
    }

    .wallet-tabs {
        width: 100%;
        justify-content: stretch;
    }

    .wallet-tabs [role="tab"] {
        flex: 1;
    }
}
