:root {
    --audi-red: #e30613;
    --bg: #07080c;
    --panel: rgba(19, 22, 31, 0.86);
    --panel-2: rgba(255, 255, 255, 0.055);
    --border: rgba(255, 255, 255, 0.11);
    --muted: #9aa3b2;
    --text: #f5f7fb;
}

* { box-sizing: border-box; }
body {
    background:
        radial-gradient(circle at top left, rgba(227, 6, 19, 0.20), transparent 34rem),
        radial-gradient(circle at bottom right, rgba(255,255,255,0.10), transparent 35rem),
        var(--bg);
    color: var(--text);
    min-height: 100vh;
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.app-shell { display: flex; min-height: 100vh; }
.sidebar {
    width: 280px;
    position: fixed;
    inset: 0 auto 0 0;
    padding: 24px 18px;
    border-right: 1px solid var(--border);
    background: rgba(8, 10, 15, 0.92);
    backdrop-filter: blur(16px);
    display: flex;
    flex-direction: column;
    z-index: 1050;
    transition: transform .24s ease;
}
.sidebar-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.58);
    z-index: 1040;
    opacity: 0;
    pointer-events: none;
    transition: opacity .2s ease;
}
.app-main { margin-left: 280px; width: calc(100% - 280px); padding: 22px; }
.content-wrap { padding-top: 20px; }

.brand-lockup { display: flex; gap: 14px; align-items: center; color: var(--text); }
.brand-title { font-weight: 800; letter-spacing: .04em; font-size: 1.2rem; }
.brand-subtitle { color: var(--muted); font-size: .75rem; text-transform: uppercase; letter-spacing: .14em; }
.brand-logo { width: 70px; max-height: 34px; object-fit: contain; filter: brightness(1.15); }
.audi-rings { width: 64px; height: 28px; position: relative; flex: 0 0 64px; }
.audi-rings span {
    position: absolute;
    width: 23px;
    height: 23px;
    border: 2px solid #f4f4f4;
    border-radius: 999px;
    top: 2px;
}
.audi-rings span:nth-child(1) { left: 0; }
.audi-rings span:nth-child(2) { left: 13px; }
.audi-rings span:nth-child(3) { left: 26px; }
.audi-rings span:nth-child(4) { left: 39px; }

.nav-link {
    color: #b8c0cf;
    border-radius: 16px;
    padding: 12px 14px;
    display: flex;
    align-items: center;
    gap: 12px;
    transition: all .2s ease;
}
.nav-link:hover { color: #fff; background: rgba(255,255,255,.07); transform: translateX(3px); }
.nav-link.active {
    color: #fff;
    background: linear-gradient(135deg, rgba(227,6,19,.96), rgba(122,0,7,.72));
    box-shadow: 0 14px 30px rgba(227,6,19,.22);
}
.sidebar-footer { margin-top: auto; }
.mini-card {
    background: var(--panel-2);
    border: 1px solid var(--border);
    border-radius: 18px;
    padding: 14px;
}

.glass-card, .metric-card, .panel, .table-panel {
    background: var(--panel);
    border: 1px solid var(--border);
    box-shadow: 0 20px 50px rgba(0,0,0,.28);
    backdrop-filter: blur(18px);
}
.topbar {
    border-radius: 26px;
    padding: 18px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 18px;
    position: sticky;
    top: 18px;
    z-index: 10;
}
.topbar-actions { display: flex; align-items: center; gap: 12px; }
.eyebrow { color: var(--audi-red); text-transform: uppercase; letter-spacing: .16em; font-size: .72rem; font-weight: 800; }
.page-title { font-size: clamp(1.4rem, 2vw, 2.05rem); font-weight: 800; }
.dealership-pill, .user-chip {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 13px;
    border: 1px solid var(--border);
    background: rgba(255,255,255,.045);
    border-radius: 999px;
}
.avatar {
    width: 34px; height: 34px;
    border-radius: 50%;
    display: grid; place-items: center;
    background: #fff;
    color: #111;
    font-weight: 800;
}
.tiny { font-size: .76rem; }

.metric-card { border-radius: 22px; padding: 18px; min-height: 142px; position: relative; overflow: hidden; }
.metric-card::after {
    content: "";
    position: absolute;
    width: 120px; height: 120px;
    right: -50px; top: -50px;
    background: rgba(227,6,19,.22);
    border-radius: 50%;
}
.metric-label { color: var(--muted); font-size: .8rem; text-transform: uppercase; letter-spacing: .09em; }
.metric-value { font-weight: 900; font-size: 2rem; margin-top: 8px; }
.metric-sub { color: var(--muted); font-size: .82rem; }
.panel { border-radius: 26px; padding: 20px; }
.table-panel { border-radius: 26px; overflow: hidden; }
.table { --bs-table-bg: transparent; --bs-table-color: #f5f7fb; --bs-table-border-color: rgba(255,255,255,.08); }
.table thead th { color: #aeb7c6; font-size: .72rem; letter-spacing: .09em; text-transform: uppercase; border-bottom: 1px solid var(--border); }
.table td, .table th { vertical-align: middle; }

.form-control, .form-select, .form-control:focus, .form-select:focus {
    background: rgba(255,255,255,.06);
    border-color: rgba(255,255,255,.12);
    color: #fff;
}
.form-control::placeholder { color: rgba(255,255,255,.45); }
.form-select option { color: #111; }
.btn-audi {
    --bs-btn-color: #fff;
    --bs-btn-bg: var(--audi-red);
    --bs-btn-border-color: var(--audi-red);
    --bs-btn-hover-color: #fff;
    --bs-btn-hover-bg: #ba000b;
    --bs-btn-hover-border-color: #ba000b;
    border-radius: 14px;
}
.btn-soft { background: rgba(255,255,255,.08); color: #fff; border: 1px solid var(--border); border-radius: 14px; }
.btn-soft:hover { background: rgba(255,255,255,.14); color: #fff; }

.progress { background: rgba(255,255,255,.08); height: 8px; border-radius: 999px; }
.progress-bar { background: linear-gradient(90deg, var(--audi-red), #ff7a7f); }
.badge-soft-success { background: rgba(25,135,84,.18); color: #70e0a2; }
.badge-soft-danger { background: rgba(220,53,69,.18); color: #ff98a3; }
.badge-soft-warning { background: rgba(255,193,7,.17); color: #ffd76d; }
.badge-soft-primary { background: rgba(13,110,253,.18); color: #8bbaff; }
.badge-soft-info { background: rgba(13,202,240,.18); color: #8ceeff; }
.badge-soft-dark { background: rgba(255,255,255,.13); color: #eee; }
.badge-soft-secondary { background: rgba(108,117,125,.18); color: #cbd2da; }
.badge-soft-purple { background: rgba(153,102,255,.18); color: #cfb7ff; }

.score-ring {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    background: conic-gradient(var(--audi-red) calc(var(--score) * 1%), rgba(255,255,255,.10) 0);
    position: relative;
    font-weight: 800;
    box-shadow: inset 0 0 0 1px rgba(255,255,255,.12);
}
.score-ring::before {
    content: "";
    position: absolute;
    inset: 5px;
    background: #121620;
    border-radius: 50%;
}
.score-ring span { position: relative; z-index: 1; font-size: .76rem; }

.pipeline-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; }
.pipeline-card { background: rgba(255,255,255,.045); border: 1px solid var(--border); border-radius: 18px; padding: 14px; }
.pipeline-card .count { font-size: 1.6rem; font-weight: 900; }

.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 22px; }
.login-card { width: min(100%, 460px); border-radius: 30px; padding: 32px; }

@media print {
    .sidebar, .topbar, form, .btn, .sidebar-backdrop { display: none !important; }
    .app-main { margin-left: 0 !important; width: 100% !important; padding: 0 !important; }
    body { background: #fff !important; color: #111 !important; }
    .panel, .table-panel, .metric-card { box-shadow: none !important; border-color: #ccc !important; background: #fff !important; color: #111 !important; }
}

@media (max-width: 991px) {
    .sidebar { transform: translateX(-100%); width: min(86vw, 310px); }
    body.sidebar-open .sidebar { transform: translateX(0); }
    body.sidebar-open .sidebar-backdrop { opacity: 1; pointer-events: auto; }
    .app-shell { display: block; }
    .app-main { margin-left: 0; width: 100%; padding: 14px; }
    .topbar { position: static; align-items: flex-start; flex-direction: column; }
    .topbar-actions { width: 100%; justify-content: space-between; }
}

@media (max-width: 576px) {
    .metric-value { font-size: 1.55rem; }
    .panel { padding: 16px; }
    .login-card { padding: 22px; }
}
