@font-face {
    font-family: 'Lato';
    src: url('../fonts/lato/Lato-Regular.woff2') format('woff2');
    font-weight: 400;
    font-style: normal;
}
@font-face {
    font-family: 'Lato';
    src: url('../fonts/lato/Lato-Bold.woff2') format('woff2');
    font-weight: 700;
    font-style: normal;
}

:root {
    --crm-blue:    #0068b9;
    --crm-dark:    #0f253a;
    --crm-gray:    #2d2c2c;
    --crm-light:   #8f9192;
    --sidebar-w:   260px;
    --topbar-h:    60px;
}

* { box-sizing: border-box; }

input, select, textarea, button {
    font-family: inherit;
}

body {
    font-family: 'Lato', sans-serif;
    background: #f0f2f5;
    color: var(--crm-gray);
    margin: 0;
}

/* ── Sidebar ── */
#sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--sidebar-w);
    height: 100vh;
    background: var(--crm-dark);
    display: flex;
    flex-direction: column;
    z-index: 1040;
    transition: transform .25s ease;
}

#sidebar .sidebar-brand {
    height: var(--topbar-h);
    display: flex;
    align-items: center;
    padding: 0 1.25rem;
    background: rgba(0,0,0,.15);
    flex-shrink: 0;
}

#sidebar .sidebar-brand span {
    font-size: 1.15rem;
    font-weight: 700;
    color: #fff;
    letter-spacing: .5px;
}

#sidebar .sidebar-brand span em {
    color: var(--crm-blue);
    font-style: normal;
}

#sidebar nav {
    flex: 1;
    overflow-y: auto;
    padding: .75rem 0;
}

#sidebar nav a {
    display: flex;
    align-items: center;
    gap: .75rem;
    padding: .6rem 1.25rem;
    color: rgba(255,255,255,.65);
    text-decoration: none;
    font-size: .875rem;
    transition: background .15s, color .15s;
}

#sidebar nav a i {
    font-size: 1.05rem;
    width: 1.25rem;
    text-align: center;
}

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

#sidebar nav a.active {
    background: var(--crm-blue);
    color: #fff;
}

#sidebar nav .nav-section {
    font-size: .7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--crm-light);
    padding: 1rem 1.25rem .35rem;
}

#sidebar .sidebar-footer {
    padding: 1rem 1.25rem;
    border-top: 1px solid rgba(255,255,255,.08);
    font-size: .78rem;
    color: var(--crm-light);
}

/* ── Topbar ── */
#topbar {
    position: fixed;
    top: 0;
    left: var(--sidebar-w);
    right: 0;
    height: var(--topbar-h);
    background: #fff;
    border-bottom: 1px solid #e3e6ea;
    display: flex;
    align-items: center;
    padding: 0 1.5rem;
    gap: 1rem;
    z-index: 1030;
}

#topbar .topbar-title {
    font-size: 1rem;
    font-weight: 500;
    color: var(--crm-gray);
    flex: 1;
}

#topbar .topbar-actions {
    display: flex;
    align-items: center;
    gap: .75rem;
}

.topbar-btn {
    background: none;
    border: none;
    color: var(--crm-light);
    font-size: 1.15rem;
    padding: .3rem .5rem;
    cursor: pointer;
    border-radius: 4px;
    transition: color .15s, background .15s;
}

.topbar-btn:hover {
    color: var(--crm-blue);
    background: #f0f2f5;
}

.topbar-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: var(--crm-blue);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: .8rem;
    font-weight: 700;
    cursor: pointer;
}

/* ── Main content ── */
#main {
    margin-left: var(--sidebar-w);
    padding-top: var(--topbar-h);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.page-content {
    flex: 1;
    padding: 1.75rem;
}

/* ── Footer ── */
#footer {
    margin-left: 0;
    background: #fff;
    border-top: 1px solid #e3e6ea;
    padding: .75rem 1.75rem;
    font-size: .78rem;
    color: var(--crm-light);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

/* ── Stat cards ── */
.stat-card {
    background: #fff;
    border: 1px solid #e3e6ea;
    border-radius: 6px;
    padding: 1.25rem;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.stat-card .stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    flex-shrink: 0;
}

.stat-card .stat-label {
    font-size: .78rem;
    color: var(--crm-light);
    margin-bottom: .15rem;
}

.stat-card .stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--crm-gray);
    line-height: 1.1;
}

.stat-card .stat-trend {
    font-size: .75rem;
    margin-top: .2rem;
}

.stat-icon.blue   { background: rgba(0,104,185,.1); color: var(--crm-blue); }
.stat-icon.green  { background: rgba(25,135,84,.1);  color: #198754; }
.stat-icon.orange { background: rgba(253,126,20,.1); color: #fd7e14; }
.stat-icon.red    { background: rgba(220,53,69,.1);  color: #dc3545; }

/* ── Generic card ── */
.crm-card {
    background: #fff;
    border: 1px solid #e3e6ea;
    border-radius: 6px;
}

.crm-card .card-header {
    padding: .75rem 1.25rem;
    border-bottom: none;
    font-weight: 500;
    font-size: .8rem;
    text-transform: uppercase;
    letter-spacing: .5px;
    background: var(--crm-dark);
    color: rgba(255,255,255,.85);
    border-radius: 6px 6px 0 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.crm-card .card-header a {
    color: rgba(255,255,255,.7);
    font-size: .75rem;
    text-transform: none;
    letter-spacing: 0;
}

.crm-card .card-body {
    padding: 1.25rem;
}

/* ── Tables ── */
.crm-table {
    width: 100%;
    font-size: .85rem;
    border-collapse: collapse;
}

.crm-table-head tr {
    background: var(--crm-blue);
}

.crm-table th {
    font-weight: 500;
    color: rgba(255,255,255,.75);
    font-size: .75rem;
    text-transform: uppercase;
    letter-spacing: .5px;
    padding: .65rem .75rem;
    border-bottom: none;
    white-space: nowrap;
}

.crm-table th a {
    color: rgba(255,255,255,.75);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    transition: color .15s;
}

.crm-table th a:hover { color: #fff; }

.crm-table td {
    padding: .65rem .75rem;
    border-bottom: 1px solid #f0f2f5;
    vertical-align: middle;
}

.crm-table tbody tr:last-child td { border-bottom: none; }

.crm-table tbody tr:hover { background: #f8f9fa; }

/* ── Badges status ── */
.badge-status {
    font-size: .7rem;
    font-weight: 500;
    padding: .25rem .6rem;
    border-radius: 4px;
}

.badge-active   { background: rgba(25,135,84,.1);  color: #198754; }
.badge-inactive { background: rgba(143,145,146,.12); color: var(--crm-light); }
.badge-pending  { background: rgba(253,126,20,.1); color: #fd7e14; }

/* ── Responsive ── */
@media (max-width: 991.98px) {
    #sidebar {
        transform: translateX(-100%);
    }
    #sidebar.open {
        transform: translateX(0);
    }
    #topbar, #main {
        left: 0;
        margin-left: 0;
    }
    #sidebar-overlay {
        display: none;
        position: fixed;
        inset: 0;
        background: rgba(0,0,0,.4);
        z-index: 1039;
    }
    #sidebar-overlay.show { display: block; }
}
