/* ============================================================
   Kalshi Crypto Arbitrage Dashboard — Style
   Bloomberg Terminal meets Modern Fintech
   ============================================================ */

:root {
    /* Backgrounds */
    --bg-primary: #0d1117;
    --bg-secondary: #161b22;
    --bg-tertiary: #1c2128;
    --bg-card: #161b22;
    --bg-card-hover: #1c2128;
    --bg-header: #0d1117ee;

    /* Accents */
    --green: #00ff88;
    --green-dim: #00ff8833;
    --green-glow: #00ff8822;
    --red: #ff4444;
    --red-dim: #ff444433;
    --red-glow: #ff444422;
    --blue: #4da6ff;
    --blue-dim: #4da6ff33;
    --yellow: #ffd866;
    --yellow-dim: #ffd86633;

    /* Text */
    --text-primary: #e6edf3;
    --text-secondary: #8b949e;
    --text-tertiary: #a0aab5;
    --text-muted: #30363d;

    /* Borders */
    --border: #21262d;
    --border-light: #30363d;
    --border-glow: #00ff8815;

    /* Fonts */
    --font-mono: 'JetBrains Mono', 'Fira Code', 'Cascadia Code', monospace;
    --font-sans: 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;

    /* Sizing */
    --header-height: 48px;
    --radius: 8px;
    --radius-sm: 6px;
}

*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 14px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--font-sans);
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.5;
    overflow-x: hidden;
}

.mono {
    font-family: var(--font-mono);
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: var(--bg-primary);
}
::-webkit-scrollbar-thumb {
    background: var(--border-light);
    border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--text-tertiary);
}

/* ============================================================
   HEADER
   ============================================================ */

.header {
    position: relative;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
    height: var(--header-height);
    background: var(--bg-header);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
}

.header-left {
    display: flex;
    align-items: center;
    gap: 14px;
}

.logo-mark {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background: var(--green-dim);
    border-radius: var(--radius-sm);
    border: 1px solid var(--green-dim);
}

.header-title h1 {
    font-size: 1.14rem;
    font-weight: 600;
    letter-spacing: -0.01em;
    color: var(--text-primary);
}

.header-subtitle {
    font-size: 0.78rem;
    color: var(--text-secondary);
    font-weight: 400;
}

.header-right {
    display: flex;
    align-items: center;
}

.header-meta {
    display: flex;
    align-items: center;
    gap: 24px;
}

.connection-status {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    border-radius: 20px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    font-size: 0.78rem;
    font-weight: 500;
}

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

.status-dot.green {
    background: var(--green);
    box-shadow: 0 0 8px var(--green), 0 0 16px var(--green-glow);
    animation: pulse-green 2s ease-in-out infinite;
}

.status-dot.yellow {
    background: var(--yellow);
    box-shadow: 0 0 8px var(--yellow);
}

.status-dot.grey {
    background: var(--text-tertiary);
}

@keyframes pulse-green {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.meta-label {
    display: block;
    font-size: 0.68rem;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-weight: 500;
}

.meta-value {
    font-size: 0.82rem;
    color: var(--text-secondary);
}

.last-updated, .uptime {
    text-align: right;
}

/* ============================================================
   DASHBOARD MAIN
   ============================================================ */

.dashboard {
    padding: 10px 16px;
    margin: 0 auto;
    overflow-x: hidden;
}

/* ============================================================
   TOP STATS ROW
   ============================================================ */

.stats-row {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 6px;
    margin-bottom: 10px;
    position: relative;
    z-index: 90;
    background: var(--bg-primary);
    transition: box-shadow 0.2s ease;
}

.stats-row.pinned {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    padding: 10px 24px 8px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.5);
    border-bottom: 1px solid var(--border);
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 9px 14px;
    position: relative;
    overflow: hidden;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
    min-width: 0;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, var(--green-dim), transparent);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.stat-card:hover {
    border-color: var(--border-light);
    box-shadow: 0 0 20px var(--border-glow);
}

.stat-card:hover::before {
    opacity: 1;
}

.stat-label {
    font-size: 0.65rem;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-weight: 500;
    margin-bottom: 4px;
    white-space: nowrap;
}

.stat-value {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.2;
    white-space: nowrap;
}

.stat-sub {
    font-size: 0.7rem;
    color: var(--text-secondary);
    margin-top: 2px;
    white-space: nowrap;
}

.stat-value.positive { color: var(--green); }
.stat-value.negative { color: var(--red); }
.stat-sub.positive { color: var(--green); }
.stat-sub.negative { color: var(--red); }

/* Kill Switch */
.kill-badge {
    display: inline-block;
    padding: 4px 14px;
    border-radius: 20px;
    font-size: 0.82rem;
    font-weight: 700;
    font-family: var(--font-mono);
    letter-spacing: 0.05em;
}

.kill-badge.off {
    background: var(--green-dim);
    color: var(--green);
    border: 1px solid var(--green-dim);
}

.kill-badge.on {
    background: var(--red-dim);
    color: var(--red);
    border: 1px solid var(--red-dim);
    animation: kill-pulse 1s ease-in-out infinite;
}

@keyframes kill-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

.tp-badge {
    display: inline-block;
    padding: 4px 14px;
    border-radius: 20px;
    font-size: 0.82rem;
    font-weight: 700;
    font-family: var(--font-mono);
    letter-spacing: 0.05em;
}

.tp-badge.on {
    background: var(--green-dim);
    color: var(--green);
    border: 1px solid var(--green-dim);
}

.tp-badge.off {
    background: var(--red-dim);
    color: var(--red);
    border: 1px solid var(--red-dim);
}

/* ============================================================
   CHARTS
   ============================================================ */

.charts-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
    margin-bottom: 0;
}

.chart-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 8px 14px 6px;
    overflow: hidden;
}

.chart-card.chart-wide {
    grid-column: 1 / -1;
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 4px;
}

.card-header h3 {
    font-size: 0.86rem;
    font-weight: 600;
    color: var(--text-secondary);
    letter-spacing: -0.01em;
}

.card-badge {
    font-size: 0.78rem;
    color: var(--text-secondary);
    padding: 3px 10px;
    background: var(--bg-tertiary);
    border-radius: 12px;
    border: 1px solid var(--border);
}

.card-badge.positive { color: var(--green); border-color: var(--green-dim); background: var(--green-glow); }
.card-badge.negative { color: var(--red); border-color: var(--red-dim); background: var(--red-glow); }

.chart-container {
    position: relative;
    height: 42px;
}

.chart-wide .chart-container {
    height: 42px;
}

/* ============================================================
   CRYPTO SECTION
   ============================================================ */

.crypto-section {
    margin-bottom: 20px;
}

.section-title {
    font-size: 0.86rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 12px;
    letter-spacing: -0.01em;
}

.crypto-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 12px;
}

.crypto-card {
    display: flex;
    align-items: center;
    gap: 14px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px 18px;
    transition: border-color 0.3s ease;
}

.crypto-card:hover {
    border-color: var(--border-light);
}

.crypto-icon {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    font-weight: 700;
    flex-shrink: 0;
}

.crypto-icon.btc {
    background: #f7931a22;
    color: #f7931a;
    border: 1px solid #f7931a33;
}

.crypto-icon.eth {
    background: #627eea22;
    color: #627eea;
    border: 1px solid #627eea33;
}

.crypto-icon.xrp {
    background: #00aae422;
    color: #00aae4;
    border: 1px solid #00aae433;
}

/* Sports icons */
.crypto-icon.nba {
    background: #c9082a22;
    color: #c9082a;
    border: 1px solid #c9082a33;
}

.crypto-icon.nfl {
    background: #01352422;
    color: #4caf50;
    border: 1px solid #4caf5033;
}

.crypto-icon.mlb {
    background: #bf003522;
    color: #bf0035;
    border: 1px solid #bf003533;
}

.crypto-icon.nhl {
    background: #00000022;
    color: #adb5bd;
    border: 1px solid #adb5bd33;
}

.crypto-icon.ncaab {
    background: #ff6f0022;
    color: #ff6f00;
    border: 1px solid #ff6f0033;
}

.crypto-icon.ncaaf {
    background: #1b5e2022;
    color: #66bb6a;
    border: 1px solid #66bb6a33;
}

.crypto-icon.mma {
    background: #d5001022;
    color: #d50010;
    border: 1px solid #d5001033;
}

.crypto-icon.wnba {
    background: #ff620022;
    color: #ff6200;
    border: 1px solid #ff620033;
}

.crypto-icon.sport-default {
    background: #7c4dff22;
    color: #7c4dff;
    border: 1px solid #7c4dff33;
}

.crypto-icon.boxing {
    background: #c6282822;
    color: #c62828;
    border: 1px solid #c6282833;
}

.crypto-icon.tennis {
    background: #c8e60022;
    color: #c8e600;
    border: 1px solid #c8e60033;
}

.crypto-icon.golf {
    background: #2e7d3222;
    color: #66bb6a;
    border: 1px solid #66bb6a33;
}

.crypto-icon.soccer {
    background: #1b5e2022;
    color: #4caf50;
    border: 1px solid #4caf5033;
}

.crypto-icon.cricket {
    background: #e6510022;
    color: #e65100;
    border: 1px solid #e6510033;
}

.crypto-icon.lacrosse {
    background: #00695c22;
    color: #26a69a;
    border: 1px solid #26a69a33;
}

.crypto-icon.nascar {
    background: #ffd60022;
    color: #ffd600;
    border: 1px solid #ffd60033;
}

.crypto-icon.esports {
    background: #7c4dff22;
    color: #7c4dff;
    border: 1px solid #7c4dff33;
}

.crypto-icon.f1 {
    background: #e1000022;
    color: #e10000;
    border: 1px solid #e1000033;
}

/* Crypto — additional coins */
.crypto-icon.sol {
    background: #9945ff22;
    color: #9945ff;
    border: 1px solid #9945ff33;
}

.crypto-icon.doge {
    background: #c2a63322;
    color: #c2a633;
    border: 1px solid #c2a63333;
}

.crypto-icon.shib {
    background: #ffa40922;
    color: #ffa409;
    border: 1px solid #ffa40933;
}

/* Weather */
.crypto-icon.weather {
    background: #00bcd422;
    color: #00bcd4;
    border: 1px solid #00bcd433;
}

.crypto-icon.gas {
    background: #ff572222;
    color: #ff7043;
    border: 1px solid #ff704333;
}

/* Financials */
.crypto-icon.spx {
    background: #1565c022;
    color: #42a5f5;
    border: 1px solid #42a5f533;
}

.crypto-icon.ndx {
    background: #00897b22;
    color: #26a69a;
    border: 1px solid #26a69a33;
}

.crypto-icon.tnx {
    background: #5c6bc022;
    color: #7986cb;
    border: 1px solid #7986cb33;
}

.crypto-icon.forex {
    background: #ff8f0022;
    color: #ffb74d;
    border: 1px solid #ffb74d33;
}

.crypto-info {
    flex: 1;
    min-width: 0;
}

.crypto-name {
    font-size: 0.86rem;
    font-weight: 500;
    color: var(--text-primary);
}

.crypto-ticker {
    color: var(--text-tertiary);
    font-size: 0.72rem;
    font-weight: 400;
}

.crypto-pnl {
    font-size: 1.28rem;
    font-weight: 600;
}

.crypto-pnl.positive { color: var(--green); }
.crypto-pnl.negative { color: var(--red); }

.crypto-stats {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 2px;
    font-size: 0.72rem;
    color: var(--text-secondary);
}

/* ============================================================
   CONTENT AREA (Full-width tables + Bot Status)
   ============================================================ */

.content-full {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 20px;
}

.table-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px 18px;
}

.table-wrapper {
    overflow-x: hidden;
    overflow-y: auto;
    max-height: 300px;
}

.table-wrapper-tall {
    max-height: 460px;
}

/* ============================================================
   DATA TABLES
   ============================================================ */

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.74rem;
    table-layout: fixed;
}

.data-table thead {
    position: sticky;
    top: 0;
    z-index: 2;
}

.data-table th {
    background: var(--bg-tertiary);
    color: var(--text-tertiary);
    font-weight: 600;
    font-size: 0.64rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: 8px 6px;
    text-align: left;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
    user-select: none;
}

.data-table th.sortable {
    cursor: pointer;
    transition: color 0.2s;
}

.data-table th.sortable:hover {
    color: var(--blue);
}

.data-table th.sort-active {
    color: var(--blue);
}

.data-table td {
    padding: 7px 6px;
    border-bottom: 1px solid var(--border);
    font-family: var(--font-mono);
    font-size: 0.7rem;
    white-space: nowrap;
    color: var(--text-secondary);
}

.data-table tr:hover td {
    background: var(--bg-tertiary);
}

/* Open position row highlight */
.data-table tr.row-open td {
    border-left-color: var(--green-dim);
}

.data-table tr.row-open td:first-child {
    border-left: 2px solid var(--green);
}

.data-table tr.empty-row td {
    text-align: center;
    color: var(--text-tertiary);
    font-family: var(--font-sans);
    font-style: italic;
    padding: 30px;
}

.data-table tr.empty-row:hover td {
    background: transparent;
}

.data-table .cell-positive { color: var(--green); }
.data-table .cell-negative { color: var(--red); }
.data-table .cell-blue { color: var(--blue); }
.data-table .cell-yellow { color: var(--yellow); }

.side-badge {
    display: inline-block;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.62rem;
    font-weight: 600;
    text-transform: uppercase;
}

.side-badge.yes {
    background: var(--green-dim);
    color: var(--green);
}

.side-badge.no {
    background: var(--red-dim);
    color: var(--red);
}

.status-badge {
    display: inline-block;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.62rem;
    font-weight: 500;
}

.status-badge.placed { background: var(--blue-dim); color: var(--blue); }
.status-badge.filled { background: var(--green-dim); color: var(--green); }
.status-badge.cancelled { background: var(--red-dim); color: var(--red); }
.status-badge.pending { background: var(--yellow-dim); color: var(--yellow); }

/* Card header with tabs */
.card-header-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.table-tabs {
    display: flex;
    gap: 4px;
    padding: 3px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
}

.tab-btn {
    font-family: var(--font-sans);
    font-size: 0.72rem;
    font-weight: 500;
    color: var(--text-secondary);
    background: transparent;
    border: none;
    border-radius: 4px;
    padding: 4px 12px;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 6px;
}

.tab-btn:hover {
    color: var(--text-primary);
    background: var(--bg-card-hover);
}

.tab-btn.active {
    color: var(--text-primary);
    background: var(--bg-card);
    box-shadow: 0 1px 3px rgba(0,0,0,0.3);
}

.tab-count {
    font-size: 0.65rem;
    padding: 1px 6px;
    border-radius: 8px;
    background: var(--bg-primary);
    color: var(--text-tertiary);
    border: 1px solid var(--border);
}

.tab-btn.active .tab-count {
    background: var(--green-dim);
    color: var(--green);
    border-color: var(--green-dim);
}

/* Pagination */
.pagination-controls {
    display: flex;
    align-items: center;
    gap: 10px;
}

.page-btn {
    font-family: var(--font-sans);
    font-size: 0.72rem;
    font-weight: 500;
    color: var(--text-secondary);
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 5px 12px;
    cursor: pointer;
    transition: all 0.2s;
}

.page-btn:hover:not(:disabled) {
    color: var(--text-primary);
    border-color: var(--border-light);
}

.page-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.page-info {
    font-size: 0.72rem;
    color: var(--text-tertiary);
}

/* ============================================================
   BOT STATUS BAR (Full-width at bottom)
   ============================================================ */

.bot-status-bar {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px 18px;
    animation: fadeIn 0.4s ease-out both;
}

.status-bar-title {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: 14px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border);
}

.status-bar-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 16px;
}

.status-bar-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.status-bar-item .panel-label {
    font-size: 0.68rem;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.status-bar-item .panel-value {
    font-size: 0.85rem;
    color: var(--text-primary);
}

/* ============================================================
   STATUS PANEL (legacy, kept for panel-label/value reuse)
   ============================================================ */

.panel-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px 18px;
}

.panel-title {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: 14px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border);
}

.panel-grid {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.panel-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.panel-label {
    font-size: 0.74rem;
    color: var(--text-tertiary);
}

.panel-value {
    font-size: 0.78rem;
    color: var(--text-secondary);
}

.daily-pnl-display {
    text-align: center;
    padding: 12px 0;
}

.daily-pnl-value {
    font-size: 2rem;
    font-weight: 700;
}

.daily-pnl-value.positive { color: var(--green); }
.daily-pnl-value.negative { color: var(--red); }

/* ============================================================
   FOOTER
   ============================================================ */

.footer {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 16px 24px;
    border-top: 1px solid var(--border);
    color: var(--text-tertiary);
    font-size: 0.72rem;
}

.footer-sep {
    opacity: 0.3;
}

/* ============================================================
   TRANSITIONS / ANIMATIONS
   ============================================================ */

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: translateY(0); }
}

.stat-card, .chart-card, .crypto-card, .table-card, .panel-card {
    animation: fadeIn 0.4s ease-out both;
}

.stats-row .stat-card:nth-child(1) { animation-delay: 0.02s; }
.stats-row .stat-card:nth-child(2) { animation-delay: 0.04s; }
.stats-row .stat-card:nth-child(3) { animation-delay: 0.06s; }
.stats-row .stat-card:nth-child(4) { animation-delay: 0.08s; }
.stats-row .stat-card:nth-child(5) { animation-delay: 0.10s; }
.stats-row .stat-card:nth-child(6) { animation-delay: 0.12s; }
.stats-row .stat-card:nth-child(7) { animation-delay: 0.14s; }

/* Number transition */
.value-updated {
    animation: flashGreen 0.6s ease-out;
}

@keyframes flashGreen {
    0% { text-shadow: 0 0 8px var(--green); }
    100% { text-shadow: none; }
}


/* ============================================================
   COLUMN WIDTHS — 17-column All Trades table
   ============================================================ */

.data-table th:nth-child(1),
.data-table td:nth-child(1) { width: 8.5%; }   /* Time */

.data-table th:nth-child(2),
.data-table td:nth-child(2) { width: 14%; overflow: hidden; text-overflow: ellipsis; }  /* Ticker */

.data-table th:nth-child(3),
.data-table td:nth-child(3) { width: 4.5%; overflow: hidden; text-overflow: ellipsis; }  /* Asset */

.data-table th:nth-child(4),
.data-table td:nth-child(4) { width: 4.5%; }   /* Action */

.data-table th:nth-child(5),
.data-table td:nth-child(5) { width: 4.5%; }   /* Side */

.data-table th:nth-child(6),
.data-table td:nth-child(6) { width: 4.5%; }   /* Price */

.data-table th:nth-child(7),
.data-table td:nth-child(7) { width: 5%; }     /* Current */

.data-table th:nth-child(8),
.data-table td:nth-child(8) { width: 3.5%; }   /* Qty */

.data-table th:nth-child(9),
.data-table td:nth-child(9) { width: 5%; }     /* Cost */

.data-table th:nth-child(10),
.data-table td:nth-child(10) { width: 5%; }    /* Edge */

.data-table th:nth-child(11),
.data-table td:nth-child(11) { width: 4.5%; }  /* Conf */

.data-table th:nth-child(12),
.data-table td:nth-child(12) { width: 4%; }    /* Now */

.data-table th:nth-child(13),
.data-table td:nth-child(13) { width: 5.5%; }  /* Payout */

.data-table th:nth-child(14),
.data-table td:nth-child(14) { width: 9%; overflow: hidden; text-overflow: ellipsis; }   /* Expiry */

.data-table th:nth-child(15),
.data-table td:nth-child(15) { width: 5.5%; }  /* Status */

.data-table th:nth-child(16),
.data-table td:nth-child(16) { width: 5%; }    /* Result */

.data-table th:nth-child(17),
.data-table td:nth-child(17) { width: 5.5%; }  /* P&L */

/* ============================================================
   RESPONSIVE
   ============================================================ */

/* Tablet landscape / small desktop */
@media (max-width: 1000px) {
    .stats-row {
        grid-template-columns: repeat(4, 1fr);
    }
    .charts-grid {
        grid-template-columns: 1fr;
    }
    .crypto-cards {
        grid-template-columns: 1fr;
    }
    .status-bar-grid {
        grid-template-columns: repeat(3, 1fr);
    }
    .header {
        flex-direction: column;
        height: auto;
        padding: 12px 16px;
        gap: 10px;
    }
    .header-meta {
        flex-wrap: wrap;
        gap: 12px;
    }
    .dashboard {
        padding: 12px 14px;
    }
    /* Allow table horizontal scroll on smaller screens */
    .table-wrapper {
        overflow-x: auto;
    }
    .data-table {
        table-layout: auto;
        min-width: 900px;
    }
}

/* Tablet portrait */
@media (max-width: 768px) {
    html {
        font-size: 13px;
    }
    .stats-row {
        grid-template-columns: repeat(3, 1fr);
    }
    .content-full {
        gap: 8px;
    }
    .status-bar-grid {
        grid-template-columns: repeat(3, 1fr);
    }
    .stat-card {
        padding: 8px 10px;
    }
    .stat-value {
        font-size: 1.1rem;
    }
    .chart-card {
        padding: 6px 10px 4px;
    }
    .table-card {
        padding: 12px;
    }
}

/* Mobile landscape — unpin stat cards */
@media (max-height: 500px) {
    .stats-row.pinned {
        position: relative;
        top: auto;
        left: auto;
        right: auto;
        padding: 0;
        box-shadow: none;
        border-bottom: none;
    }
}

/* Phone */
@media (max-width: 480px) {
    html {
        font-size: 12px;
    }
    .header {
        padding: 10px 12px;
        gap: 8px;
    }
    .header-title h1 {
        font-size: 1rem;
    }
    .header-meta {
        gap: 8px;
    }
    .connection-status {
        padding: 4px 8px;
        font-size: 0.72rem;
    }
    .dashboard {
        padding: 8px 10px;
    }
    .stats-row {
        grid-template-columns: repeat(2, 1fr);
        gap: 4px;
        margin-bottom: 8px;
    }
    .stat-card {
        padding: 7px 9px;
    }
    .stat-label {
        font-size: 0.58rem;
    }
    .stat-value {
        font-size: 1rem;
    }
    .stat-sub {
        font-size: 0.62rem;
    }
    .kill-badge, .tp-badge {
        padding: 3px 10px;
        font-size: 0.72rem;
    }
    .charts-grid {
        gap: 6px;
    }
    .chart-container,
    .chart-wide .chart-container {
        height: 80px;
    }
    .card-header h3 {
        font-size: 0.78rem;
    }
    .card-badge {
        font-size: 0.68rem;
        padding: 2px 8px;
    }
    /* Table: horizontal scroll with wider min-width */
    .table-wrapper {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    .data-table {
        table-layout: auto;
        min-width: 800px;
    }
    .data-table th {
        padding: 6px 5px;
        font-size: 0.58rem;
    }
    .data-table td {
        padding: 6px 5px;
        font-size: 0.64rem;
    }
    .card-header-left {
        flex-wrap: wrap;
        gap: 8px;
    }
    .table-tabs {
        gap: 2px;
    }
    .tab-btn {
        font-size: 0.65rem;
        padding: 3px 8px;
    }
    .pagination-controls {
        gap: 6px;
    }
    .page-btn {
        font-size: 0.65rem;
        padding: 4px 8px;
    }
    /* Crypto cards */
    .crypto-card {
        padding: 12px 14px;
        gap: 10px;
    }
    .crypto-icon {
        width: 36px;
        height: 36px;
        font-size: 1.1rem;
    }
    .crypto-pnl {
        font-size: 1.1rem;
    }
    /* Bot status */
    .status-bar-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }
    .bot-status-bar {
        padding: 12px 14px;
    }
    /* Footer */
    .footer {
        padding: 12px 16px;
        font-size: 0.65rem;
        flex-wrap: wrap;
    }
}

/* Subtle grid background on body */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image:
        linear-gradient(var(--border) 1px, transparent 1px),
        linear-gradient(90deg, var(--border) 1px, transparent 1px);
    background-size: 60px 60px;
    opacity: 0.15;
    pointer-events: none;
    z-index: -1;
}
.status-badge.canceled { background: rgba(255,255,255,0.05); color: var(--muted); }
