:root {
    --bg:       #13161b;
    --panel:    #1c2028;
    --card:     #252a35;
    --border:   #2e3545;
    --accent:   #4f9cf9;
    --green:    #3ecf8e;
    --red:      #e05c5c;
    --yellow:   #f0b429;
    --text:     #dce4f0;
    --muted:    #7a8899;
    --hover:    #2a3040;
    --selected: #1a3a5c;
}

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

body {
    font-family: 'Segoe UI', system-ui, sans-serif;
    background: var(--bg);
    color: var(--text);
    font-size: 13px;
    height: 100vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* ── SCROLLBARS ── */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--muted); }

/* ── TOP BAR ── */
.topbar {
    background: var(--panel);
    border-bottom: 1px solid var(--border);
    padding: 8px 14px;
    display: flex;
    align-items: center;
    gap: 14px;
    flex-shrink: 0;
}

.filter-group {
    display: flex;
    align-items: center;
    gap: 6px;
}

.filter-group label {
    color: var(--muted);
    font-size: 11px;
    white-space: nowrap;
}

input, select, textarea {
    background: var(--card);
    border: 1px solid var(--border);
    color: var(--text);
    padding: 5px 8px;
    border-radius: 5px;
    font-size: 12px;
    font-family: inherit;
    outline: none;
    transition: border-color 0.15s;
}

input:focus, select:focus, textarea:focus {
    border-color: var(--accent);
}

input[type="date"] { width: 130px; }

.stats-bar {
    display: flex;
    gap: 20px;
    margin-left: auto;
    padding-left: 16px;
    border-left: 1px solid var(--border);
}

.stat { display: flex; flex-direction: column; align-items: flex-end; gap: 1px; }
.stat-label { color: var(--muted); font-size: 10px; text-transform: uppercase; letter-spacing: 0.05em; }
.stat-value { font-weight: 700; font-size: 15px; }
.stat-value.negative { color: var(--red); }
.stat-value.positive { color: var(--green); }

/* ── REPORT OPTIONS ── */
.report-options {
    background: var(--panel);
    border-bottom: 1px solid var(--border);
    padding: 5px 14px;
    display: flex;
    align-items: center;
    gap: 18px;
    flex-shrink: 0;
}

.chk {
    display: flex;
    align-items: center;
    gap: 5px;
    cursor: pointer;
    color: var(--muted);
    font-size: 12px;
    user-select: none;
    transition: color 0.15s;
}
.chk:hover { color: var(--text); }
.chk input[type="checkbox"] {
    width: 13px; height: 13px;
    accent-color: var(--accent);
    cursor: pointer;
    padding: 0; border: none;
    background: none;
}

.customers-count {
    margin-left: auto;
    color: var(--muted);
    font-size: 12px;
    font-weight: 600;
}

/* ── MAIN CONTENT ── */
.main-content {
    display: flex;
    flex: 1;
    overflow: hidden;
}

/* ── LEFT PANEL ── */
.left-panel {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    border-right: 1px solid var(--border);
    overflow: hidden;
}

/* ── RIGHT PANEL ── */
.right-panel {
    width: 460px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    background: var(--panel);
    overflow: hidden;
}

.panel-header {
    padding: 9px 14px;
    font-weight: 700;
    font-size: 12px;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--accent);
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

/* ── TABS ── */
.tab-nav {
    display: flex;
    background: var(--panel);
    border-bottom: 1px solid var(--border);
    overflow-x: auto;
    scrollbar-width: none;
    flex-shrink: 0;
}
.tab-nav::-webkit-scrollbar { display: none; }

.tab-btn {
    padding: 8px 14px;
    border: none;
    background: transparent;
    color: var(--muted);
    cursor: pointer;
    font-size: 12px;
    font-family: inherit;
    white-space: nowrap;
    border-bottom: 2px solid transparent;
    transition: all 0.15s;
}
.tab-btn:hover { color: var(--text); background: var(--hover); }
.tab-btn.active { color: var(--accent); border-bottom-color: var(--accent); font-weight: 600; }

.sub-tab-nav { background: var(--bg); }

/* ── TAB CONTENT ── */
.tab-content {
    display: none;
    flex: 1;
    overflow: hidden;
    flex-direction: column;
    min-height: 0;
}
.tab-content.active { display: flex; }

.commission-tabs {
    display: flex;
    flex-direction: column;
    flex: 1;
    overflow: hidden;
}

/* ── TABLE ── */
.table-wrapper {
    overflow: auto;
    flex: 1;
    min-height: 0;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
}

.data-table th {
    background: var(--card);
    color: var(--muted);
    padding: 7px 10px;
    text-align: left;
    font-weight: 600;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    position: sticky;
    top: 0;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
    z-index: 1;
    min-width: 60px;
    user-select: none;
}

/* ── SORT INDICATORS & COLUMN DRAG ── */
.data-table.sortable th { cursor: pointer; }
.data-table.sortable th:hover { color: var(--text); background: var(--hover); }
.data-table.sortable th[draggable="true"] { cursor: grab; }
.data-table.sortable th[draggable="true"]:active { cursor: grabbing; }
th.col-dragging { opacity: 0.4; }
th.col-drag-over { background: var(--accent) !important; color: #fff !important; }
.data-table th.sort-asc::after  { content: ' ▲'; color: var(--accent); font-size: 9px; }
.data-table th.sort-desc::after { content: ' ▼'; color: var(--accent); font-size: 9px; }

.data-table td {
    padding: 6px 10px;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}

.data-table tbody tr { transition: background 0.1s; }
.data-table tbody tr:hover { background: var(--hover); cursor: pointer; }
.data-table tbody tr.selected { background: var(--selected); }

/* ── VALUE COLOURS ── */
.positive { color: var(--green); font-weight: 600; }
.negative { color: var(--red); font-weight: 600; }
.neutral  { color: var(--yellow); }

/* ── STATUS BADGES ── */
.badge {
    display: inline-block;
    padding: 2px 9px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
}
.badge-green  { background: rgba(62,207,142,0.12); color: var(--green); }
.badge-red    { background: rgba(224,92,92,0.12);  color: var(--red); }
.badge-yellow { background: rgba(240,180,41,0.12); color: var(--yellow); }
.badge-blue   { background: rgba(79,156,249,0.12); color: var(--accent); }

/* ── BUTTONS ── */
.btn-primary {
    background: var(--accent);
    color: #fff;
    border: none;
    padding: 6px 18px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 600;
    font-family: inherit;
    transition: opacity 0.15s;
    white-space: nowrap;
}
.btn-primary:hover { opacity: 0.85; }

.btn-secondary {
    background: var(--card);
    color: var(--text);
    border: 1px solid var(--border);
    padding: 5px 12px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 12px;
    font-family: inherit;
    transition: background 0.15s;
}
.btn-secondary:hover { background: var(--hover); }

/* ── BET SLIP RIGHT PANEL ── */
.betslip-layout {
    display: flex;
    flex-direction: column;
    flex: 1;
    overflow: hidden;
    min-height: 0;
}

.wager-summary {
    padding: 8px 12px;
    background: var(--card);
    border-bottom: 1px solid var(--border);
    font-size: 12px;
    color: var(--muted);
    flex-shrink: 0;
}

.selections-wrapper { max-height: 150px; flex-shrink: 0; }

/* ── IMAGE AREA ── */
.image-area {
    flex: 1;
    min-height: 100px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg);
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
    cursor: pointer;
    position: relative;
    overflow: hidden;
    transition: background 0.15s;
}
.image-area:hover { background: #0f1115; }

.image-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
}

.no-image-circle {
    width: 110px;
    height: 110px;
    border-radius: 50%;
    border: 2px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    color: var(--muted);
    font-size: 11px;
    line-height: 1.5;
}

.image-hint {
    position: absolute;
    bottom: 7px;
    right: 10px;
    font-size: 10px;
    color: var(--muted);
    opacity: 0;
    transition: opacity 0.2s;
}
.image-area:hover .image-hint { opacity: 1; }

/* ── BET LEGS NAV ── */
.bet-legs-nav {
    display: flex;
    gap: 4px;
    padding: 6px 10px;
    background: var(--panel);
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
    flex-wrap: wrap;
}

.leg-btn {
    padding: 3px 10px;
    border-radius: 4px;
    border: 1px solid var(--border);
    background: var(--card);
    color: var(--muted);
    font-size: 11px;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.15s;
}
.leg-btn:hover { border-color: var(--accent); color: var(--text); }
.leg-btn.active { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
.leg-btn.win  { border-color: var(--green); color: var(--green); }
.leg-btn.loss { border-color: var(--red); color: var(--red); }

/* ── EXCEPTIONS ── */
.exceptions-section {
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    max-height: 90px;
}

.section-label {
    padding: 5px 12px;
    font-size: 10px;
    font-weight: 700;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    background: var(--card);
    border-bottom: 1px solid var(--border);
    border-top: 1px solid var(--border);
    flex-shrink: 0;
}

.exceptions-wrapper { max-height: 70px; }

/* ── CHECK HISTORY ── */
.history-layout {
    display: flex;
    flex-direction: column;
    flex: 1;
    overflow: hidden;
    min-height: 0;
}

.comment-section {
    padding: 10px;
    border-top: 1px solid var(--border);
    display: flex;
    gap: 8px;
    align-items: flex-start;
    flex-shrink: 0;
}
.comment-section textarea { flex: 1; resize: none; }

/* ── COVER ── */
.cover-layout {
    display: flex;
    flex-direction: column;
    flex: 1;
    overflow: hidden;
    min-height: 0;
}

.cover-selections-wrapper { max-height: 130px; flex-shrink: 0; }

.cover-calculator {
    padding: 10px 12px;
    border-top: 1px solid var(--border);
    flex-shrink: 0;
}

.cover-bets-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 5px;
    margin: 8px 0 12px;
}

.cover-bet-row {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--muted);
}
.cover-bet-row input[type="checkbox"] {
    accent-color: var(--accent);
    width: 13px; height: 13px;
    padding: 0; border: none; background: none;
}
.cover-bet-row input[type="text"] { width: 75px; }

.cover-costs { margin-bottom: 10px; }

.cover-cost-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 0;
    border-bottom: 1px solid var(--border);
    font-size: 12px;
    gap: 8px;
}

.cover-cost-right { display: flex; align-items: center; gap: 6px; }

.cost-highlight {
    color: var(--red);
    font-weight: 700;
    font-size: 15px;
}

.cover-actions {
    display: flex;
    gap: 6px;
    align-items: center;
    margin-top: 10px;
}

/* ── LIVE INFO ── */
.live-info {
    padding: 12px;
    display: flex;
    flex-direction: column;
    flex: 1;
    overflow: auto;
}

.info-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 9px 0;
    border-bottom: 1px solid var(--border);
}
.info-label { color: var(--muted); font-size: 12px; }
.info-value { font-weight: 600; font-size: 13px; }

.live-bets-section { margin-top: 14px; flex: 1; display: flex; flex-direction: column; }

/* ── IMAGE OVERLAY ── */
.image-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.88);
    z-index: 999;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    cursor: pointer;
    animation: fadeIn 0.15s ease;
}
.image-overlay.visible { display: flex; }

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.image-overlay img {
    max-width: 92%;
    max-height: 88vh;
    object-fit: contain;
    border-radius: 4px;
    box-shadow: 0 8px 40px rgba(0,0,0,0.6);
}

.overlay-hint {
    margin-top: 14px;
    color: rgba(255,255,255,0.35);
    font-size: 12px;
}

/* ── EMPTY STATE ── */
.empty-state {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: var(--muted);
    font-size: 13px;
    font-style: italic;
}

/* ── DASHBOARD TOOLBAR ── */
.dashboard-toolbar {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 10px;
    background: var(--panel);
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

/* ── DASHBOARD GRID ── */
.dashboard-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1px;
    background: var(--border);
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    align-content: start;
}

.dashboard-grid.has-expanded {
    display: flex;
    overflow: hidden;
}

.dashboard-grid.has-expanded .dash-card:not(.expanded) {
    display: none;
}

.dashboard-grid.has-expanded .dash-card.expanded {
    flex: 1;
}

.dash-card {
    background: var(--panel);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
}

.dash-card.dragging { opacity: 0.35; }
.dash-card.drag-over { outline: 2px solid var(--accent); outline-offset: -2px; }

.dash-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 5px 10px;
    background: var(--card);
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
    cursor: grab;
    user-select: none;
}
.dash-card-header:active { cursor: grabbing; }

.dash-card-title {
    font-size: 11px;
    font-weight: 700;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.dash-card-actions {
    display: flex;
    align-items: center;
    gap: 2px;
}

.dash-width-btn,
.dash-expand-btn {
    background: none;
    border: none;
    color: var(--muted);
    cursor: pointer;
    font-size: 14px;
    padding: 1px 4px;
    line-height: 1;
    transition: color 0.15s;
    font-family: inherit;
    border-radius: 3px;
}
.dash-width-btn:hover,
.dash-expand-btn:hover { color: var(--accent); background: var(--hover); }
.dash-card.expanded .dash-expand-btn { color: var(--accent); }

/* ── RESIZE HANDLE ── */
.dash-resize-handle {
    height: 5px;
    cursor: ns-resize;
    background: transparent;
    flex-shrink: 0;
    transition: background 0.15s;
    position: relative;
}
.dash-resize-handle::after {
    content: '';
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    width: 30px;
    height: 2px;
    border-radius: 2px;
    background: var(--border);
    opacity: 0;
    transition: opacity 0.15s;
}
.dash-card:hover .dash-resize-handle::after { opacity: 1; }
.dash-card.expanded .dash-resize-handle { display: none; }
