:root {
    --bg: #eef2f6;
    --bg-soft: #f7f9fc;
    --surface: #ffffff;
    --surface-muted: #f4f7fb;
    --surface-strong: #101828;
    --border: #dce3ec;
    --border-strong: #c8d2df;
    --text: #152033;
    --text-muted: #697386;
    --text-soft: #8a94a6;
    --primary: #2563eb;
    --primary-hover: #1d4ed8;
    --primary-soft: #e8efff;
    --success: #16a34a;
    --success-soft: #e8f8ee;
    --warning: #d97706;
    --warning-soft: #fff6df;
    --danger: #dc2626;
    --danger-soft: #fff0f0;
    --radius-sm: 6px;
    --radius: 8px;
    --shadow: 0 1px 2px rgba(21, 32, 51, .06);
    --shadow-lg: 0 18px 45px rgba(21, 32, 51, .12);
}

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

html,
body {
    min-height: 100%;
}

body {
    background: var(--bg);
    color: var(--text);
    font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
    font-size: 14px;
    line-height: 1.45;
    -webkit-font-smoothing: antialiased;
}

button,
input {
    font: inherit;
}

.layout {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    position: sticky;
    top: 0;
    width: 248px;
    height: 100vh;
    flex-shrink: 0;
    padding: 22px 16px;
    background: var(--surface-strong);
    color: #fff;
    border-right: 1px solid rgba(255, 255, 255, .08);
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    height: 42px;
    margin-bottom: 26px;
    padding: 0 8px;
    font-size: 21px;
    font-weight: 800;
    letter-spacing: 0;
}

.logo:before {
    content: "";
    width: 30px;
    height: 30px;
    border-radius: var(--radius);
    background: linear-gradient(135deg, #22c55e, #2563eb);
    box-shadow: 0 10px 22px rgba(37, 99, 235, .35);
}

.logo span {
    color: #72e59a;
}

.menu {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.menu-item {
    display: flex;
    align-items: center;
    min-height: 42px;
    padding: 0 12px;
    border-radius: var(--radius);
    color: #cbd5e1;
    text-decoration: none;
    font-weight: 600;
    transition: background .16s ease, color .16s ease, transform .16s ease;
}

.menu-item:hover {
    background: rgba(255, 255, 255, .08);
    color: #fff;
}

.menu-item.active {
    background: #fff;
    color: var(--text);
    box-shadow: var(--shadow);
}

.content {
    width: min(100%, calc(100vw - 248px));
    flex: 1;
    padding: 24px;
}

.navbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 18px;
}

.navbar h1 {
    font-size: 25px;
    font-weight: 800;
    letter-spacing: 0;
}

.page-kicker {
    margin-top: 4px;
    color: var(--text-muted);
    font-size: 13px;
}

.navbar-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 8px;
}

.btn,
.refresh-toggle,
.fix-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 38px;
    padding: 0 14px;
    border: 1px solid transparent;
    border-radius: var(--radius);
    cursor: pointer;
    font-size: 13px;
    font-weight: 700;
    text-decoration: none;
    transition: background .16s ease, border-color .16s ease, color .16s ease, box-shadow .16s ease;
    white-space: nowrap;
}

.btn-primary {
    background: var(--primary);
    color: #fff;
    box-shadow: 0 8px 18px rgba(37, 99, 235, .22);
}

.btn-primary:hover {
    background: var(--primary-hover);
}

.btn-secondary,
.refresh-toggle {
    background: var(--surface);
    border-color: var(--border);
    color: var(--text);
}

.btn-secondary:hover,
.refresh-toggle:hover {
    border-color: var(--border-strong);
    box-shadow: var(--shadow);
}

.btn-danger {
    background: var(--danger-soft);
    border-color: #fecaca;
    color: var(--danger);
}

.alert {
    padding: 13px 15px;
    border: 1px solid transparent;
    border-radius: var(--radius);
    margin-bottom: 10px;
    font-weight: 600;
}

.alert-success {
    background: var(--success-soft);
    border-color: #bbf7d0;
    color: #166534;
}

.alert-warning {
    background: var(--warning-soft);
    border-color: #fed7aa;
    color: #9a3412;
}

.alert-danger {
    background: var(--danger-soft);
    border-color: #fecaca;
    color: #991b1b;
}

.cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
    gap: 14px;
    margin-bottom: 18px;
}

.card {
    min-width: 0;
    padding: 18px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.card-title {
    display: block;
    margin-bottom: 8px;
    color: var(--text-muted);
    font-size: 12px;
    font-weight: 800;
    letter-spacing: .04em;
    text-transform: uppercase;
}

.card-value {
    color: var(--text);
    font-size: 30px;
    font-weight: 800;
    letter-spacing: 0;
}

.filters {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 14px;
    padding: 10px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.filters-left,
.filters-right {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.dropdown {
    position: relative;
}

.dropdown-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    height: 38px;
    min-width: 160px;
    max-width: 250px;
    padding: 0 12px;
    overflow: hidden;
    background: var(--surface-muted);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    cursor: pointer;
    font-size: 13px;
    font-weight: 700;
}

.dropdown-text {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.dropdown-arrow {
    color: var(--text-soft);
    font-size: 12px;
    transition: transform .16s ease;
}

.dropdown.open .dropdown-toggle {
    background: #fff;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, .12);
}

.dropdown.open .dropdown-arrow {
    transform: rotate(180deg);
}

.dropdown-menu {
    position: absolute;
    top: calc(100% + 7px);
    left: 0;
    z-index: 20;
    display: none;
    min-width: 230px;
    max-height: 360px;
    overflow: auto;
    padding: 6px;
    background: #fff;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
}

.dropdown.open .dropdown-menu {
    display: block;
}

.dropdown-item {
    display: flex;
    align-items: center;
    min-height: 34px;
    padding: 0 10px;
    border-radius: var(--radius-sm);
    color: var(--text);
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
}

.dropdown-item:hover {
    background: var(--surface-muted);
}

.dropdown-item.active {
    background: var(--primary-soft);
    color: var(--primary);
}

.table-card {
    overflow: hidden;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 52px;
    padding: 0 16px;
    border-bottom: 1px solid var(--border);
    color: var(--text);
    font-weight: 800;
}

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

thead {
    background: var(--surface-muted);
}

th,
td {
    padding: 13px 14px;
    text-align: left;
    vertical-align: middle;
}

th {
    color: var(--text-muted);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: .04em;
    text-transform: uppercase;
    white-space: nowrap;
}

td {
    border-top: 1px solid #edf1f6;
    color: var(--text);
}

tbody tr:hover {
    background: #f8fbff;
}

small {
    color: var(--text-muted);
}

.badge,
.result-badge,
.fixed-value {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 25px;
    padding: 0 9px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 800;
    white-space: nowrap;
}

.badge-success,
.result-badge-win,
.fixed-value {
    background: var(--success-soft);
    color: var(--success);
}

.badge-warning {
    background: var(--warning-soft);
    color: var(--warning);
}

.badge-danger,
.result-badge-loss {
    background: var(--danger-soft);
    color: var(--danger);
}

.input,
.select,
.textarea {
    width: 100%;
    min-height: 38px;
    padding: 8px 11px;
    background: #fff;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius);
    color: var(--text);
    outline: none;
}

.input:focus,
.select:focus,
.textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, .12);
}

.live-status {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 38px;
    padding: 0 12px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text-muted);
    font-size: 13px;
    font-weight: 800;
}

.live-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--success);
    box-shadow: 0 0 0 4px rgba(22, 163, 74, .12);
}

.live-status.loading .live-dot {
    background: var(--primary);
    box-shadow: 0 0 0 4px rgba(37, 99, 235, .12);
    animation: pulse .8s infinite;
}

.live-status.error .live-dot {
    background: var(--danger);
    box-shadow: 0 0 0 4px rgba(220, 38, 38, .12);
}

@keyframes pulse {
    0%, 100% { opacity: .35; }
    50% { opacity: 1; }
}

.odds-widget {
    min-width: 148px;
}

.odds-chart {
    display: block;
    width: 132px;
    height: 28px;
}

.odds-values {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 3px;
    font-size: 12px;
}

.odds-start,
.odds-arrow {
    color: var(--text-soft);
}

.odds-current {
    color: var(--success);
    font-weight: 800;
}

.profit-positive {
    color: var(--success);
}

.profit-negative {
    color: var(--danger);
}

.results-stats .card-value {
    font-size: 26px;
}

#bet-amount {
    max-width: 160px;
    font-size: 20px;
    font-weight: 800;
}

.signal-fixed {
    background: #f0fbf4;
}

.signal-fixed:hover {
    background: #e4f8eb;
}

.fix-btn {
    min-height: 30px;
    padding: 0 10px;
    background: var(--primary);
    color: #fff;
    font-size: 12px;
}

.fix-btn:hover {
    background: var(--primary-hover);
}

.link {
    color: var(--primary);
    font-weight: 700;
    text-decoration: none;
}

.link:hover {
    color: var(--primary-hover);
    text-decoration: underline;
    text-underline-offset: 3px;
}

#auto-bet-toggle.active {
    background: var(--success);
    border-color: var(--success);
    color: #fff;
}

::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border: 2px solid transparent;
    border-radius: 999px;
    background-clip: content-box;
}

@media (max-width: 1100px) {
    .layout {
        display: block;
    }

    .sidebar {
        position: static;
        width: 100%;
        height: auto;
        padding: 12px;
    }

    .logo {
        margin-bottom: 10px;
    }

    .menu {
        flex-direction: row;
        overflow-x: auto;
        padding-bottom: 2px;
    }

    .menu-item {
        flex: 0 0 auto;
    }

    .content {
        width: 100%;
        padding: 16px;
    }

    .navbar {
        align-items: flex-start;
        flex-direction: column;
    }

    .navbar-actions {
        justify-content: flex-start;
    }

    .filters {
        align-items: stretch;
        flex-direction: column;
    }
}

@media (max-width: 760px) {
    .content {
        padding: 12px;
    }

    .navbar h1 {
        font-size: 22px;
    }

    .cards {
        grid-template-columns: 1fr;
    }

    .dropdown,
    .dropdown-toggle {
        width: 100%;
        max-width: none;
    }

    .filters-left,
    .filters-right {
        align-items: stretch;
        flex-direction: column;
    }

    .table-card {
        overflow-x: auto;
    }

    table {
        min-width: 860px;
    }
}
