* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    padding: 0;
    font-family: Arial, sans-serif;
    background: #f4f6fa;
    color: #172033;
}

/* =========================
   MAIN CRM LAYOUT
========================= */

.crm-layout {
    min-height: 100vh;
    display: flex;
}

/* =========================
   LEFT SIDEBAR
========================= */

.crm-sidebar {
    width: 250px;
    min-height: 100vh;
    background: #ffffff;
    border-right: 1px solid #e2e7ef;
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    z-index: 1000;
    display: flex;
    flex-direction: column;
}

.sidebar-brand {
    height: 72px;
    display: flex;
    align-items: center;
    padding: 0 24px;
    font-size: 20px;
    font-weight: 800;
    color: #17345f;
    border-bottom: 1px solid #e8ecf2;
}

.sidebar-nav {
    padding: 18px 12px;
    overflow-y: auto;
}

.sidebar-nav a {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 11px 14px;
    margin-bottom: 4px;
    border-radius: 8px;
    color: #344054;
    text-decoration: none;
    font-size: 14px;
    font-weight: 600;
    transition: 0.2s ease;
}

.sidebar-nav a:hover {
    background: #f0f4ff;
    color: #315cf5;
}

.sidebar-nav a.active {
    background: #315cf5;
    color: #ffffff;
}

.sidebar-nav a span {
    width: 22px;
    text-align: center;
    font-size: 16px;
}

.sidebar-section {
    margin: 22px 10px 8px;
    padding: 0 4px;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.08em;
    color: #7b8495;
}

/* =========================
   MAIN CONTENT AREA
========================= */

.crm-main {
    width: calc(100% - 250px);
    margin-left: 250px;
    min-height: 100vh;
}

/* =========================
   TOP BAR
========================= */

.crm-topbar {
    height: 72px;
    background: #ffffff;
    border-bottom: 1px solid #e2e7ef;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 28px;
}

.crm-topbar-brand {
    font-size: 18px;
    font-weight: 800;
    color: #17345f;
}

.crm-user {
    font-size: 14px;
    color: #344054;
}

.crm-user a {
    color: #315cf5;
    text-decoration: none;
}

.crm-user a:hover {
    text-decoration: underline;
}

/* =========================
   PAGE CONTENT
========================= */

.crm-content {
    padding: 32px;
    max-width: 1400px;
}

.page-head {
    margin-bottom: 26px;
}

.page-head h1 {
    margin: 0 0 8px;
    font-size: 30px;
    color: #172033;
}

.muted {
    margin: 0;
    color: #667085;
    font-size: 15px;
}

/* =========================
   DASHBOARD CARDS
========================= */

.grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 18px;
}

.tile {
    display: block;
    min-height: 125px;
    padding: 22px;
    background: #ffffff;
    border: 1px solid #e2e7ef;
    border-radius: 14px;
    text-decoration: none;
    color: #172033;
    transition: 0.2s ease;
}

.tile:hover {
    border-color: #315cf5;
    box-shadow: 0 8px 25px rgba(20, 35, 60, 0.08);
    transform: translateY(-2px);
}

.tile b {
    display: block;
    margin-bottom: 10px;
    font-size: 16px;
    color: #17345f;
}

.tile span {
    display: block;
    color: #667085;
    font-size: 14px;
}

/* =========================
   BUTTONS
========================= */

.button {
    display: inline-block;
    padding: 10px 16px;
    border-radius: 8px;
    background: #315cf5;
    color: #ffffff;
    text-decoration: none;
    font-weight: 700;
    border: 0;
    cursor: pointer;
}

.button:hover {
    background: #244bd7;
}

.button.secondary {
    background: #315cf5;
    color: #ffffff;
}

/* =========================
   TABLES
========================= */

.table-wrap {
    width: 100%;
    overflow-x: auto;
    background: #ffffff;
    border: 1px solid #e2e7ef;
    border-radius: 12px;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th,
td {
    padding: 12px 14px;
    border-bottom: 1px solid #e8ecf2;
    text-align: left;
}

th {
    background: #f8f9fc;
    font-size: 13px;
}

td {
    font-size: 14px;
}

tr:last-child td {
    border-bottom: 0;
}

/* =========================
   FORMS
========================= */

input,
select,
textarea {
    width: 100%;
    padding: 11px 13px;
    border: 1px solid #d0d5dd;
    border-radius: 8px;
    background: #ffffff;
    font-size: 14px;
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: #315cf5;
    box-shadow: 0 0 0 3px rgba(49, 92, 245, 0.1);
}

/* =========================
   RESPONSIVE
========================= */

@media (max-width: 900px) {
    .crm-sidebar {
        width: 220px;
    }

    .crm-main {
        width: calc(100% - 220px);
        margin-left: 220px;
    }

    .grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 650px) {
    .crm-sidebar {
        position: relative;
        width: 100%;
        min-height: auto;
    }

    .crm-layout {
        display: block;
    }

    .crm-main {
        width: 100%;
        margin-left: 0;
    }

    .grid {
        grid-template-columns: 1fr;
    }

    .crm-topbar {
        padding: 0 18px;
    }

    .crm-content {
        padding: 20px;
    }
}