:root {
    --bg-primary: #0d1117;
    --bg-secondary: #161b22;
    --bg-card: #1c2333;
    --bg-sidebar: #0d1117;
    --accent: #1f6feb;
    --positive: #00b894;
    --negative: #d63031;
    --text-primary: #e6edf3;
    --text-muted: #8b949e;
    --border: #30363d;
}

body {
    background-color: var(--bg-primary);
    color: var(--text-primary);
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    min-height: 100vh;
}

.sidebar {
    width: 220px;
    min-height: 100vh;
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border);
    position: fixed;
    top: 0;
    left: 0;
    z-index: 100;
    transition: transform 0.2s ease;
}

.sidebar-brand {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.sidebar-brand i {
    color: var(--accent);
    font-size: 1.4rem;
}

.sidebar .nav-link {
    color: var(--text-muted);
    padding: 0.6rem 1rem;
    border-radius: 6px;
    margin-bottom: 2px;
    display: flex;
    align-items: center;
    gap: 0.6rem;
    font-size: 0.9rem;
    transition: all 0.15s;
}

.sidebar .nav-link:hover {
    color: var(--text-primary);
    background: var(--bg-card);
}

.sidebar .nav-link.active {
    color: var(--text-primary);
    background: var(--accent);
}

.sidebar-footer {
    border-top: 1px solid var(--border);
    padding-top: 0.75rem;
}

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

.main-content {
    margin-left: 220px;
    min-height: 100vh;
}

/* sticky mobile top bar (shown < 992px) */
.mobile-topbar {
    background: var(--bg-sidebar);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 90;
    padding: 0.5rem 0.25rem;
}

.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 8px;
}

.card-header {
    background: transparent;
    border-bottom: 1px solid var(--border);
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text-muted);
}

.stat-card .card-body {
    padding: 1rem;
}

.stat-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 0.25rem;
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

.text-positive { color: var(--positive) !important; }
.text-negative { color: var(--negative) !important; }

.table-dark {
    --bs-table-bg: transparent;
    --bs-table-border-color: var(--border);
}

.table-dark thead th {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    font-weight: 600;
    border-bottom-color: var(--border);
}

.table-dark td {
    font-size: 0.85rem;
    vertical-align: middle;
    padding: 0.5rem 0.75rem;
}

.table-hover > tbody > tr:hover {
    background-color: rgba(31,111,235,0.06);
}

.form-select,
.form-control {
    font-size: 0.85rem;
}

.form-select-sm,
.form-control-sm {
    padding: 0.35rem 0.6rem;
}

.tier-badge {
    font-size: 1.5rem;
    font-weight: 800;
    padding: 0.75rem 2rem;
    border-radius: 8px;
    display: inline-block;
    text-transform: uppercase;
    letter-spacing: 2px;
}

.tier-starter { background: #21262d; color: #8b949e; border: 2px solid #30363d; }
.tier-growth { background: #0f2942; color: #58a6ff; border: 2px solid #1f6feb; }
.tier-scaler { background: #0d2818; color: #3fb950; border: 2px solid #238636; }
.tier-advanced { background: #2d1f0e; color: #d29922; border: 2px solid #9e6a03; }
.tier-full { background: #2a1030; color: #bc8cff; border: 2px solid #8957e5; }

.progress-bar-custom {
    height: 8px;
    background: #21262d;
    border-radius: 4px;
}

.progress-bar-custom .progress-bar {
    border-radius: 4px;
}

.badge {
    font-weight: 600;
    font-size: 0.72rem;
    padding: 0.3em 0.55em;
}

@media (max-width: 991px) {
    /* tablet: sidebar overlays, content full width */
    .sidebar {
        transform: translateX(-100%);
        width: 260px;
    }
    .sidebar.show {
        transform: translateX(0);
        box-shadow: 4px 0 20px rgba(0,0,0,0.5);
    }
    .main-content {
        margin-left: 0;
        padding: 1rem !important;
    }
    .stat-value {
        font-size: 1.25rem;
    }
}

@media (max-width: 767px) {
    /* phone */
    .main-content {
        padding: 0.75rem !important;
    }

    /* stat cards: stack to 2-across with tighter spacing */
    .stat-card .card-body {
        padding: 0.75rem;
    }
    .stat-value {
        font-size: 1.1rem;
    }
    .stat-label {
        font-size: 0.68rem;
    }

    /* tables: horizontal scroll on touch */
    .table-responsive {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    .table-dark th,
    .table-dark td {
        white-space: nowrap;
        padding: 0.45rem 0.55rem;
        font-size: 0.78rem;
    }

    /* bigger tap targets for touch */
    .btn {
        font-size: 0.85rem;
        padding: 0.45rem 0.75rem;
    }
    .btn-sm {
        font-size: 0.78rem;
        padding: 0.35rem 0.6rem;
    }
    .nav-link {
        padding: 0.7rem 0.9rem;
        font-size: 1rem;
    }
    .form-control, .form-select {
        font-size: 0.95rem;
        padding: 0.5rem 0.7rem;
    }

    .tier-badge {
        font-size: 1.05rem;
        padding: 0.5rem 0.9rem;
    }

    h4 { font-size: 1.25rem !important; }

    /* card headers: wrap on small screens */
    .card-header {
        font-size: 0.82rem;
    }

    .progress-bar-custom .progress-bar {
        border-radius: 4px;
    }
    .fs-5 {
        font-size: 1.1rem !important;
    }

    /* modal / chart canvases resize */
    canvas { max-width: 100% !important; height: auto !important; }
}

/* extra-small phones */
@media (max-width: 420px) {
    .col-6 { padding-left: 6px; padding-right: 6px; }
    .row { margin-left: -6px; margin-right: -6px; }
    .stat-value { font-size: 0.95rem; }
    .d-flex.gap-2 { gap: 0.35rem !important; }
}
