/* ============================================================
   Dealer DMS — Light mode / Navy Blue theme
   ============================================================ */

:root {
    --navy-900: #0a1f44;
    --navy-800: #0f2c5c;
    --navy-700: #163a72;
    --navy-600: #1e4a8f;
    --navy-500: #2c5ea8;
    --accent: #2c7be5;
    --accent-soft: #e8f0fe;
    --bg: #f4f7fb;
    --surface: #ffffff;
    --border: #e2e8f0;
    --text-main: #1a2536;
    --text-muted: #6b7686;
    --success: #1e9e6c;
    --warning: #d97706;
    --danger: #d7373f;
    --radius: 10px;
    --shadow-sm: 0 1px 2px rgba(10, 31, 68, 0.06);
    --shadow-md: 0 6px 20px rgba(10, 31, 68, 0.08);
}

* { box-sizing: border-box; }

body {
    background: var(--bg);
    color: var(--text-main);
    font-family: 'Inter', 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    font-size: 14.5px;
}

a { text-decoration: none; }

/* ---------- Top navbar ---------- */
.topnav {
    background: linear-gradient(135deg, var(--navy-900), var(--navy-700));
    color: #fff;
    padding: 0 1.25rem;
    height: 62px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 1030;
    box-shadow: var(--shadow-md);
}

.topnav .brand {
    display: flex;
    align-items: center;
    gap: .6rem;
    font-weight: 700;
    font-size: 1.15rem;
    color: #fff;
    letter-spacing: .2px;
}

.topnav .brand .brand-badge {
    width: 34px;
    height: 34px;
    border-radius: 8px;
    background: rgba(255,255,255,.12);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 1rem;
}

.topnav .nav-actions { display: flex; align-items: center; gap: 1rem; }

.topnav .btn-toggle-sidebar {
    background: transparent;
    border: 0;
    color: #fff;
    font-size: 1.3rem;
    display: none;
}

.user-chip {
    display: flex;
    align-items: center;
    gap: .55rem;
    background: rgba(255,255,255,.08);
    border-radius: 999px;
    padding: .3rem .8rem .3rem .3rem;
}
.user-chip .avatar {
    width: 30px; height: 30px; border-radius: 50%;
    background: var(--accent);
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: .8rem; color: #fff;
}
.user-chip .role-badge {
    font-size: .68rem;
    text-transform: uppercase;
    letter-spacing: .5px;
    color: rgba(255,255,255,.7);
}

/* ---------- Layout ---------- */
.app-shell { display: flex; min-height: calc(100vh - 62px); }

.sidebar {
    width: 240px;
    flex-shrink: 0;
    background: var(--surface);
    border-right: 1px solid var(--border);
    padding: 1.1rem .8rem;
}

.sidebar .nav-section-title {
    font-size: .68rem;
    text-transform: uppercase;
    letter-spacing: .8px;
    color: var(--text-muted);
    margin: 1.1rem .6rem .4rem;
    font-weight: 700;
}

.sidebar .nav-link {
    display: flex;
    align-items: center;
    gap: .65rem;
    color: var(--text-main);
    padding: .6rem .7rem;
    border-radius: 8px;
    font-weight: 500;
    font-size: .89rem;
    margin-bottom: .15rem;
}
.sidebar .nav-link i { width: 18px; text-align: center; color: var(--navy-600); }
.sidebar .nav-link:hover { background: var(--accent-soft); color: var(--navy-800); }
.sidebar .nav-link.active {
    background: var(--navy-800);
    color: #fff;
}
.sidebar .nav-link.active i { color: #fff; }

.main-content { flex: 1; padding: 1.5rem; min-width: 0; }

.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: .75rem;
    margin-bottom: 1.25rem;
}
.page-header h1 {
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--navy-900);
    margin: 0;
}
.page-header .subtitle { color: var(--text-muted); font-size: .87rem; margin-top: .15rem; }

/* ---------- Cards ---------- */
.card {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
}
.card-header {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    font-weight: 700;
    color: var(--navy-900);
    padding: .9rem 1.1rem;
}

.stat-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.1rem 1.2rem;
    box-shadow: var(--shadow-sm);
    position: relative;
    overflow: hidden;
}
.stat-card .stat-label { color: var(--text-muted); font-size: .78rem; font-weight: 600; text-transform: uppercase; letter-spacing: .4px; }
.stat-card .stat-value { font-size: 1.6rem; font-weight: 800; color: var(--navy-900); margin-top: .25rem; }
.stat-card .stat-icon {
    position: absolute; right: 1rem; top: 1rem;
    width: 42px; height: 42px; border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    background: var(--accent-soft); color: var(--navy-700); font-size: 1.1rem;
}

/* ---------- Buttons ---------- */
.btn-navy {
    background: var(--navy-800);
    border-color: var(--navy-800);
    color: #fff;
}
.btn-navy:hover { background: var(--navy-900); border-color: var(--navy-900); color: #fff; }
.btn-outline-navy {
    border-color: var(--navy-700);
    color: var(--navy-700);
}
.btn-outline-navy:hover { background: var(--navy-700); color: #fff; }

/* ---------- Tables ---------- */
.table-clean thead th {
    background: #f0f4fa;
    color: var(--navy-800);
    font-size: .74rem;
    text-transform: uppercase;
    letter-spacing: .4px;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
    font-weight: 700;
}
.table-clean td { vertical-align: middle; font-size: .87rem; }
.table-clean tbody tr:hover { background: #f7fafd; }

.chassis-pill {
    font-family: 'SFMono-Regular', Consolas, monospace;
    background: var(--accent-soft);
    color: var(--navy-800);
    padding: .18rem .55rem;
    border-radius: 6px;
    font-size: .8rem;
    font-weight: 600;
}

.badge-scheme {
    background: #eaf5ee;
    color: var(--success);
    border: 1px solid #cdeadb;
    font-weight: 600;
    padding: .32rem .6rem;
    border-radius: 999px;
    font-size: .74rem;
    display: inline-block;
    margin: .12rem .2rem .12rem 0;
}
.badge-multi-warning {
    background: #fdf2e9;
    color: var(--warning);
    border: 1px solid #f6dfc4;
}

/* ---------- Login page ---------- */
.login-shell {
    min-height: 100vh;
    display: flex;
    background: linear-gradient(135deg, var(--navy-900) 0%, var(--navy-700) 55%, var(--navy-600) 100%);
}
.login-visual {
    flex: 1.1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 4rem;
    color: #fff;
}
.login-visual h1 { font-size: 2.1rem; font-weight: 800; margin-bottom: 1rem; }
.login-visual p { color: rgba(255,255,255,.75); max-width: 420px; line-height: 1.6; }
.login-form-panel {
    flex: 1;
    background: var(--bg);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}
.login-card {
    width: 100%;
    max-width: 380px;
    background: var(--surface);
    border-radius: 14px;
    box-shadow: var(--shadow-md);
    padding: 2.2rem;
}

/* ---------- Search tabs ---------- */
.search-type-tabs .nav-link {
    border-radius: 999px;
    padding: .45rem 1rem;
    font-weight: 600;
    font-size: .84rem;
    color: var(--navy-700);
    border: 1px solid var(--border);
    margin-right: .4rem;
}
.search-type-tabs .nav-link.active {
    background: var(--navy-800);
    color: #fff;
    border-color: var(--navy-800);
}

/* ---------- Utility ---------- */
.text-navy { color: var(--navy-800); }
.bg-navy { background: var(--navy-800); }
.section-divider { border-top: 1px solid var(--border); margin: 1.5rem 0; }

/* ---------- Responsive / Mobile ---------- */
@media (max-width: 991.98px) {
    .topnav .btn-toggle-sidebar { display: inline-flex; align-items: center; }
    .sidebar {
        position: fixed;
        left: -260px;
        top: 62px;
        bottom: 0;
        z-index: 1040;
        transition: left .22s ease;
        box-shadow: var(--shadow-md);
    }
    .sidebar.open { left: 0; }
    .sidebar-backdrop {
        display: none;
        position: fixed; inset: 62px 0 0 0;
        background: rgba(10,31,68,.35);
        z-index: 1035;
    }
    .sidebar-backdrop.show { display: block; }
    .main-content { padding: 1rem; }
    .login-visual { display: none; }
    .page-header h1 { font-size: 1.15rem; }
}

@media (max-width: 575.98px) {
    .stat-card .stat-value { font-size: 1.3rem; }
    .table-clean { font-size: .8rem; }
}
