:root {
    --sidebar-width: 248px;
    --surface: #ffffff;
    --surface-muted: #f5f7fb;
    --border: #dfe4ee;
    --text-muted: #6b7280;
}

body {
    background: var(--surface-muted);
    font-size: 14px;
    letter-spacing: 0;
}

.app-shell {
    min-height: 100vh;
    display: grid;
    grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
}

.sidebar {
    background: #10233f;
    color: #fff;
    padding: 18px;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
}

.brand {
    font-size: 19px;
    font-weight: 700;
    margin-bottom: 20px;
}

.sidebar nav {
    display: grid;
    gap: 6px;
}

.sidebar .nav-label {
    font-size: 11px;
    text-transform: uppercase;
    color: #6B7280;
    margin-top: 16px;
    margin-bottom: 2px;
    padding-left: 12px;
    padding-right: 12px;
    font-weight: 600;
    letter-spacing: 0.5px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.sidebar .nav-label:hover {
    color: #9ca3af;
}

.sidebar .nav-group-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.sidebar .nav-group.expanded .nav-group-content {
    max-height: 500px;
}

.sidebar a {
    color: #d9e3f5;
    text-decoration: none;
    padding: 10px 12px;
    border-radius: 8px;
    display: block;
}

.sidebar a:hover,
.sidebar a.active {
    background: rgba(255,255,255,.12);
    color: #fff;
}

.main {
    padding: 22px;
    min-width: 0;
}

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

.topbar h1 {
    font-size: 24px;
    margin: 0;
}

.topbar span {
    color: var(--text-muted);
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.user-chip {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 6px 12px;
}

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

.stat-card,
.content-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 16px;
}

.stat-card strong {
    display: block;
    font-size: 26px;
}

.stat-card span {
    color: var(--text-muted);
}

.content-card {
    margin-bottom: 18px;
}

.table-responsive {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
}

.table {
    margin-bottom: 0;
}

.badge-soft {
    background: #eef2ff;
    color: #273c75;
}

.score-hot {
    color: #b42318;
    font-weight: 700;
}

.score-warm {
    color: #b54708;
    font-weight: 700;
}

.score-cold {
    color: #175cd3;
    font-weight: 700;
}

.funnel {
    display: grid;
    gap: 10px;
}

.funnel-step {
    display: grid;
    grid-template-columns: 160px 1fr 90px;
    gap: 12px;
    align-items: center;
}

.funnel-bar {
    height: 32px;
    background: #d9e7ff;
    border-radius: 6px;
    overflow: hidden;
}

.funnel-fill {
    height: 100%;
    background: #2f6fed;
    min-width: 4px;
}

.install-body {
    min-height: 100vh;
    display: grid;
    place-items: center;
    background: #eef3fb;
    padding: 18px;
}

.install-card {
    width: min(760px, 100%);
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 26px;
}

.install-header {
    display: flex;
    justify-content: space-between;
    align-items: start;
    gap: 16px;
}

.install-header h1 {
    font-size: 24px;
}

.login-wrap {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 20px;
    background: #edf2f7;
}

.login-box {
    width: min(420px, 100%);
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 24px;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 14px;
}

.actions-row {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    align-items: center;
}

html[data-bs-theme="dark"] {
    --surface: #172033;
    --surface-muted: #0d1422;
    --border: #2c3850;
    --text-muted: #aab4c4;
}

html[data-bs-theme="dark"] .sidebar {
    background: #080f1d;
}

html[data-bs-theme="dark"] .table-responsive,
html[data-bs-theme="dark"] .stat-card,
html[data-bs-theme="dark"] .content-card,
html[data-bs-theme="dark"] .user-chip {
    background: var(--surface);
    border-color: var(--border);
}

@media (max-width: 820px) {
    .app-shell {
        grid-template-columns: 1fr;
    }

    .sidebar {
        position: static;
        height: auto;
    }

    .sidebar nav {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .main {
        padding: 14px;
    }

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

    .funnel-step {
        grid-template-columns: 1fr;
    }
}

