* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    min-height: 100%;
}

body {
    font-family:
        Arial,
        Helvetica,
        sans-serif;

    background: #f5f7fa;
    color: #20252b;
}

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

a {
    color: inherit;
    text-decoration: none;
}

h1,
h2,
h3,
p {
    margin-top: 0;
}

.muted {
    color: #73808c;
}

.app-shell {
    min-height: 100vh;
    display: flex;
}

.sidebar {
    width: 250px;
    min-height: 100vh;
    background: #18212b;
    color: #ffffff;
    flex-shrink: 0;
}

.sidebar-brand {
    padding: 24px;
    font-size: 24px;
    font-weight: 800;
    border-bottom:
        1px solid rgba(255,255,255,.08);
}

.sidebar-brand span {
    display: block;
    margin-top: 4px;
    font-size: 12px;
    font-weight: 400;
    color: #98a5b2;
}

.sidebar-nav {
    padding: 16px 12px;
}

.nav-section {
    margin: 22px 12px 8px;
    color: #71808f;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .08em;
}

.nav-item {
    display: block;
    padding: 11px 12px;
    margin-bottom: 3px;
    border-radius: 6px;
    color: #c7d0d8;
}

.nav-item.active {
    background: #273544;
    color: white;
    font-weight: 700;
}

.nav-item.disabled {
    opacity: .45;
    cursor: default;
}

.main-area {
    width: 100%;
    min-width: 0;
}

.topbar {
    min-height: 82px;
    padding: 17px 28px;

    display: flex;
    justify-content: space-between;
    align-items: center;

    background: white;

    border-bottom:
        1px solid #dfe4e9;
}

.topbar h1 {
    margin-bottom: 4px;
    font-size: 22px;
}

.topbar-user {
    display: flex;
    align-items: center;
    gap: 18px;
    text-align: right;
}

.role {
    margin-top: 2px;
    color: #7a8692;
    font-size: 12px;
    text-transform: uppercase;
}

.content {
    padding: 28px;
    max-width: 1500px;
}

.stats-grid {
    display: grid;

    grid-template-columns:
        repeat(4, minmax(0, 1fr));

    gap: 18px;
    margin-bottom: 24px;
}

.stat-card {
    background: white;

    border:
        1px solid #dfe4e9;

    border-radius: 9px;

    padding: 21px;
}

.stat-label {
    color: #72808d;
    font-size: 13px;
    font-weight: 600;
}

.stat-value {
    margin-top: 8px;
    font-size: 31px;
    font-weight: 800;
}

.panel {
    background: white;

    border:
        1px solid #dfe4e9;

    border-radius: 9px;

    overflow: hidden;
}

.panel-header {
    padding: 20px 22px;

    border-bottom:
        1px solid #e4e8ec;
}

.panel-header h2 {
    margin-bottom: 4px;
    font-size: 18px;
}

.panel-header p {
    margin-bottom: 0;
}

.table-wrap {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th,
td {
    padding: 14px 20px;

    border-bottom:
        1px solid #edf0f2;

    text-align: left;
}

th {
    background: #fafbfc;
    color: #64717d;
    font-size: 12px;
    text-transform: uppercase;
}

.empty-state {
    padding: 45px 25px;
    color: #7b8792;
    text-align: center;
}

.btn {
    border: 0;
    border-radius: 6px;
    padding: 10px 14px;
    cursor: pointer;
    font-weight: 700;
}

.btn-primary {
    background: #202b36;
    color: white;
}

.btn-secondary {
    background: #edf1f4;
    color: #27323d;
}

.btn-full {
    width: 100%;
}

.alert {
    padding: 12px 14px;
    border-radius: 6px;
    margin-bottom: 20px;
}

.alert-error {
    background: #fff0f0;
    border: 1px solid #e0aaaa;
    color: #8a2020;
}


/* LOGIN */

.login-body {
    min-height: 100vh;

    display: flex;
    justify-content: center;
    align-items: center;

    padding: 24px;

    background: #eef2f5;
}

.login-card {
    width: 100%;
    max-width: 410px;

    padding: 34px;

    background: white;

    border:
        1px solid #dce2e7;

    border-radius: 10px;

    box-shadow:
        0 12px 35px rgba(0,0,0,.06);
}

.login-logo {
    margin-bottom: 28px;
    font-size: 25px;
    font-weight: 800;
}

.login-card h1 {
    margin-bottom: 5px;
}

.login-card label {
    display: block;
    margin: 19px 0 7px;
    font-weight: 700;
}

.login-card input {
    width: 100%;
    padding: 12px;

    border:
        1px solid #bfc8d1;

    border-radius: 6px;
}

.login-card .btn {
    margin-top: 25px;
}


/* TABLET */

@media (max-width: 1000px) {

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


/* MOBILE */

@media (max-width: 720px) {

    .sidebar {
        display: none;
    }

    .content {
        padding: 18px;
    }

    .topbar {
        padding: 14px 18px;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }

    .topbar-user .role {
        display: none;
    }
}
/* =========================================================
   CLIENTS
   ========================================================= */

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

.btn-light {
    background: #ffffff;
    color: #34404c;

    border:
        1px solid #d7dde3;
}

.alert-success {
    background: #edf9f0;
    border: 1px solid #b9ddc1;
    color: #216c33;
}

.panel-subheader {
    padding: 12px 20px;

    background: #fafbfc;

    border-bottom:
        1px solid #e8ecef;

    color: #6d7985;

    font-size: 13px;
}

.client-search {
    display: grid;

    grid-template-columns:
        minmax(250px, 1fr)
        220px
        auto;

    gap: 14px;

    align-items: end;
}

.search-field label,
.filter-field label {
    display: block;

    margin-bottom: 6px;

    font-size: 12px;
    font-weight: 700;

    color: #66737f;
}

.search-field input,
.filter-field select {
    width: 100%;

    padding: 10px 11px;

    border:
        1px solid #c7d0d8;

    border-radius: 6px;

    background: white;
}

.search-actions {
    display: flex;
    gap: 8px;
}

.table-meta {
    margin-top: 4px;

    color: #7e8994;

    font-size: 12px;
}

.badge {
    display: inline-block;

    padding: 4px 8px;

    border-radius: 999px;

    background: #eef2f5;

    color: #596673;

    font-size: 12px;
    font-weight: 700;
}

.pagination {
    padding: 16px 20px;

    display: flex;
    align-items: center;
    justify-content: center;

    gap: 14px;

    border-top:
        1px solid #edf0f2;
}


/* FORM */

.form-container {
    max-width: 1000px;
}

.crm-form {
    display: flex;
    flex-direction: column;

    gap: 18px;
}

.form-card {
    background: white;

    border:
        1px solid #dfe4e9;

    border-radius: 9px;

    overflow: hidden;
}

.form-card-header {
    padding: 18px 20px;

    border-bottom:
        1px solid #e6eaee;
}

.form-card-header h2 {
    margin-bottom: 0;

    font-size: 17px;
}

.form-card-header p {
    margin:
        5px
        0
        0;

    color: #788490;

    font-size: 13px;
}

.form-card-body {
    padding: 20px;
}

.form-grid {
    display: grid;
    gap: 18px;
}

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

.form-group label {
    display: block;

    margin-bottom: 7px;

    font-size: 13px;
    font-weight: 700;

    color: #4f5c68;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;

    padding: 11px 12px;

    border:
        1px solid #c8d0d8;

    border-radius: 6px;

    background: white;
}

.form-group textarea {
    resize: vertical;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: 2px solid #314357;
    outline-offset: 1px;
}

.type-selector {
    display: flex;
    gap: 12px;

    max-width: 500px;
}

.radio-card {
    flex: 1;

    display: flex !important;
    align-items: center;

    gap: 9px;

    padding: 12px 14px;

    border:
        1px solid #ced5dc;

    border-radius: 7px;

    cursor: pointer;
}

.radio-card input {
    width: auto;
    margin: 0;
}

.form-actions {
    display: flex;
    justify-content: flex-end;

    gap: 10px;

    padding-bottom: 30px;
}


/* TABLET */

@media (max-width: 900px) {

    .client-search {
        grid-template-columns: 1fr;
    }

    .search-actions {
        justify-content: flex-start;
    }
}


/* MOBILE */

@media (max-width: 720px) {

    .form-grid.two {
        grid-template-columns: 1fr;
    }

    .type-selector {
        flex-direction: column;
    }

    .form-actions {
        flex-direction: column-reverse;
    }

    .form-actions .btn {
        width: 100%;
        text-align: center;
    }
}
/* =========================================================
   CLIENT PROFILE
   ========================================================= */

.client-link {
    color: #233d59;
    font-weight: 700;
}

.client-link:hover {
    text-decoration: underline;
}

.client-profile-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
    margin-bottom: 20px;
}

.profile-card {
    background: #ffffff;
    border: 1px solid #dfe4e9;
    border-radius: 9px;
    overflow: hidden;
}

.profile-card-header {
    padding: 17px 20px;
    border-bottom: 1px solid #e6eaee;
}

.profile-card-header h2 {
    margin: 0;
    font-size: 17px;
}

.profile-card-body {
    padding: 8px 20px;
}

.detail-row {
    display: flex;
    justify-content: space-between;
    gap: 20px;

    padding: 13px 0;

    border-bottom: 1px solid #edf0f2;
}

.detail-row:last-child {
    border-bottom: 0;
}

.detail-row span {
    color: #76838f;
}

.detail-row strong {
    text-align: right;
}

.contact-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;

    padding: 13px 0;

    border-bottom: 1px solid #edf0f2;
}

.contact-row:last-child {
    border-bottom: 0;
}

.contact-label {
    display: flex;
    align-items: center;
    gap: 8px;

    margin-bottom: 5px;

    color: #75818c;

    font-size: 12px;
}

.badge-muted {
    opacity: .65;
}

.profile-stats {
    margin-top: 0;
}

.profile-section {
    margin-top: 20px;
}

.profile-note {
    padding: 20px;
    line-height: 1.6;
}

.activity-list {
    padding: 0 20px;
}

.activity-item {
    display: flex;
    justify-content: space-between;
    gap: 20px;

    padding: 15px 0;

    border-bottom: 1px solid #edf0f2;
}

.activity-item:last-child {
    border-bottom: 0;
}

.activity-time {
    white-space: nowrap;

    color: #7a8692;

    font-size: 13px;
}

.alert-warning {
    background: #fff8e8;

    border: 1px solid #ead292;

    color: #725510;
}


/* TABLET */

@media (max-width: 900px) {

    .client-profile-grid {
        grid-template-columns: 1fr;
    }
}


/* MOBILE */

@media (max-width: 720px) {

    .detail-row {
        flex-direction: column;
        gap: 5px;
    }

    .detail-row strong {
        text-align: left;
    }

    .activity-item {
        flex-direction: column;
        gap: 5px;
    }
}
/* =========================================================
   CLIENT PROFILE - CONTACT MANAGEMENT
   ========================================================= */

.contact-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.contact-add-form {
    padding: 18px 20px;
    border-bottom: 1px solid #e6eaee;
    background: #fafbfc;
}

.contact-primary-option {
    display: flex;
    align-items: flex-end;
}

.checkbox-line {
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 40px;
    cursor: pointer;
}

.checkbox-line input {
    width: auto;
    margin: 0;
}

.contact-form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 12px;
}

.contact-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.contact-actions form {
    margin: 0;
}

@media (max-width: 720px) {
    .contact-card-header {
        align-items: flex-start;
        flex-direction: column;
    }

    .contact-form-actions {
        justify-content: stretch;
    }

    .contact-form-actions .btn {
        flex: 1;
    }
}

