:root {
    --app-primary: #343a40;
    --app-primary-hover: #23272b;
    --app-primary-active: #1d2124;
    --nx-navy: #343a40;
    --nx-teal: #0f766e;
    --nx-teal-deep: #115e59;
    --nx-ink: #1e293b;
    --nx-muted: #64748b;
    --nx-line: #e2e8f0;
    --nx-bg: #f4f7fb;
    --nx-remaining: #475569;
}

body {
    font-family: "Segoe UI", "Source Sans Pro", sans-serif;
    color: var(--nx-ink);
}

.content-wrapper {
    background: var(--nx-bg);
}

.main-sidebar,
.main-sidebar::before {
    background: var(--nx-navy);
}

.brand-link {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 57px;
    padding: 0.55rem 0.75rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08) !important;
}

.nx-brand-full,
.nx-brand-mark {
    display: block;
    object-fit: contain;
}

.nx-brand-full {
    width: 100%;
    max-height: 46px;
}

.nx-brand-mark {
    display: none;
    width: 34px;
    height: 34px;
}

.sidebar-mini.sidebar-collapse .brand-link .nx-brand-full {
    display: none;
}

.sidebar-mini.sidebar-collapse .brand-link .nx-brand-mark {
    display: block;
}

.brand-text {
    font-weight: 650;
    letter-spacing: 0.01em;
}

.nx-mark {
    width: 32px;
    height: 32px;
    border-radius: 9px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--nx-teal);
    color: #fff;
    font-weight: 700;
    flex: 0 0 auto;
}

.nx-mark-lg {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    font-size: 1.2rem;
}

.nx-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(15, 118, 110, 0.9);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    margin-right: 0.75rem;
    flex: 0 0 auto;
    overflow: hidden;
}

.nx-avatar img,
.nx-nav-avatar,
.nx-profile-photo {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.nx-nav-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    margin-right: 0.45rem;
}

.nx-profile-photo {
    width: 72px;
    height: 72px;
    border-radius: 50%;
}

.nx-role,
.nx-workspace-label {
    color: #94a3b8;
    font-size: 0.82rem;
}

.sidebar-dark-primary .nav-sidebar .nav-link {
    color: rgba(255, 255, 255, 0.88);
}

.sidebar-dark-primary .nav-sidebar .nav-link:hover {
    background: #3e444a;
    color: #fff;
}

.sidebar-dark-primary .nav-sidebar .nav-link.active,
.sidebar-dark-primary .nav-sidebar .nav-link.active:hover {
    background: var(--app-primary-active);
    color: #fff;
    box-shadow: inset 3px 0 0 #fff;
}

.nav-sidebar .nav-link .right {
    transition: transform 0.2s ease;
}

.nav-sidebar .nav-link.disabled {
    color: rgba(255, 255, 255, 0.38);
    cursor: default;
    pointer-events: none;
}

.nav-sidebar .nav-header {
    color: rgba(255, 255, 255, 0.45);
    letter-spacing: 0.04em;
}

.nx-navbar {
    border-bottom: 1px solid var(--nx-line);
}

.nx-page-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: 1rem;
}

.nx-page-head h1 {
    font-size: 1.55rem;
    font-weight: 650;
    margin: 0;
}

.nx-subtitle {
    margin: 0.25rem 0 0;
    color: var(--nx-muted);
}

.nx-card,
.nx-stat {
    border: 0;
    border-radius: 14px;
    box-shadow: 0 8px 24px rgba(15, 39, 68, 0.05);
    background: #fff;
}

.nx-card {
    transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.nx-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 28px rgba(15, 39, 68, 0.08);
}

.nx-stat {
    padding: 1.15rem 1.2rem;
    min-height: 124px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.nx-stat-grid {
    margin-left: -0.625rem;
    margin-right: -0.625rem;
}

.nx-stat-grid > [class*="col-"] {
    padding-left: 0.625rem;
    padding-right: 0.625rem;
    margin-bottom: 1.25rem;
}

.nx-stat span,
.nx-meta span {
    color: var(--nx-muted);
    font-size: 0.82rem;
}

.nx-stat strong {
    display: block;
    margin: 0.35rem 0 0.2rem;
    font-size: 1.7rem;
    line-height: 1.1;
    font-weight: 700;
}

.nx-stat small {
    color: var(--nx-muted);
}

.nx-stat-achieved {
    background: #f0fdfa;
    box-shadow: inset 0 0 0 1px #ccfbf1;
}

.nx-money-received strong { color: #1e7a46; }
.nx-money-pending strong { color: #b45309; }
.badge-warning { background: #f59e0b; color: #1f2933; }
.nx-stat-achieved strong {
    color: var(--nx-teal);
}

.nx-stat-remaining strong {
    color: var(--nx-remaining);
}

.nx-progress {
    height: 10px;
    background: #e2e8f0;
    border-radius: 999px;
    overflow: hidden;
}

.nx-progress > span {
    display: block;
    height: 100%;
    background: var(--nx-teal);
    border-radius: inherit;
}

.nx-count-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem 1.25rem;
    margin-top: 0.9rem;
    color: var(--nx-muted);
    font-size: 0.92rem;
}

.nx-section-title {
    font-size: 1.05rem;
    font-weight: 650;
    margin-bottom: 0.9rem;
}

.nx-rules {
    margin: 0;
    padding-left: 1.1rem;
}

.nx-rules li + li {
    margin-top: 0.45rem;
}

.nx-meta {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.9rem;
}

.nx-meta strong {
    display: block;
    font-size: 1.15rem;
}

.nx-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.nx-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    background: #f8fafc;
    border: 1px solid var(--nx-line);
    border-radius: 999px;
    padding: 0.35rem 0.7rem;
    font-size: 0.92rem;
}

.nx-chip i {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
}

.nx-activity + .nx-activity {
    margin-top: 0.8rem;
}

.nx-activity {
    display: flex;
    flex-direction: column;
}

.nx-activity span {
    color: var(--nx-muted);
    font-size: 0.85rem;
}

.nx-empty {
    text-align: center;
    padding: 2rem 1rem;
    color: var(--nx-muted);
}

.nx-empty i {
    font-size: 1.6rem;
    margin-bottom: 0.6rem;
    color: #94a3b8;
}

.nx-empty h3 {
    color: var(--nx-ink);
    font-size: 1.1rem;
    margin-bottom: 0.35rem;
}

.btn-primary,
.btn-primary:focus {
    background: var(--app-primary);
    border-color: var(--app-primary);
    border-radius: 0.375rem;
    box-shadow: none;
}

.btn-primary:hover {
    background: var(--app-primary-hover);
    border-color: var(--app-primary-hover);
}

.btn-primary:active,
.btn-primary:not(:disabled):not(.disabled):active {
    background: var(--app-primary-active);
    border-color: var(--app-primary-active);
}

.btn-primary:focus {
    box-shadow: 0 0 0 0.2rem rgba(52, 58, 64, 0.35);
}

.btn-primary:disabled,
.btn-primary.disabled {
    background: var(--app-primary);
    border-color: var(--app-primary);
    opacity: 0.45;
}

.btn-outline-primary {
    color: var(--app-primary);
    border-color: var(--app-primary);
    border-radius: 0.375rem;
}

.btn-outline-primary:hover,
.btn-outline-primary:focus {
    background: var(--app-primary);
    border-color: var(--app-primary);
    color: #fff;
}

.page-item.active .page-link {
    background: var(--app-primary);
    border-color: var(--app-primary);
}

.custom-control-input:checked ~ .custom-control-label::before {
    background-color: var(--app-primary);
    border-color: var(--app-primary);
}

.nx-preloader {
    position: fixed;
    inset: 0;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.85rem;
    background: rgba(244, 247, 251, 0.94);
    color: var(--app-primary);
    text-align: center;
}

.nx-preloader.is-hidden {
    display: none;
}

.nx-preloader-logo {
    width: min(220px, 70vw);
    height: auto;
    object-fit: contain;
}

.nx-preloader .spinner-border {
    color: var(--app-primary);
    width: 2.4rem;
    height: 2.4rem;
}

.nx-preloader p {
    margin: 0;
}

.nx-auth {
    background: #e7eef5;
}

.nx-auth .login-logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    text-align: left;
    font-size: 1.6rem;
}

.nx-auth .login-logo small {
    display: block;
    font-size: 0.85rem;
    color: var(--nx-muted);
    font-weight: 400;
}

.nx-auth-card {
    border: 0;
    border-radius: 16px;
    box-shadow: 0 16px 40px rgba(15, 39, 68, 0.08);
}

.nx-auth-box-wide {
    width: 480px;
}

.form-control {
    border-radius: 8px;
}

.form-control:focus {
    border-color: #5eead4;
    box-shadow: 0 0 0 0.15rem rgba(15, 118, 110, 0.15);
}

.table thead th {
    border-top: 0;
    color: var(--nx-muted);
    font-weight: 650;
    font-size: 0.82rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

@keyframes nx-rise {
    from {
        opacity: 0;
        transform: translateY(6px);
    }
    to {
        opacity: 1;
        transform: none;
    }
}

.nx-rise {
    animation: nx-rise 0.35s ease both;
}

.nx-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-bottom: 1rem;
}

.nx-tabs a {
    border-radius: 999px;
    padding: 0.35rem 0.75rem;
    background: #fff;
    border: 1px solid var(--nx-line);
    color: var(--nx-ink);
}

.nx-tabs a.active {
    background: var(--nx-teal);
    border-color: var(--nx-teal);
    color: #fff;
}

.nx-timeline {
    border-left: 2px solid var(--nx-line);
    margin: 0;
    padding: 0 0 0 1rem;
    list-style: none;
}

.nx-timeline li {
    margin-bottom: 1rem;
}

.nx-timeline time {
    display: block;
    color: var(--nx-muted);
    font-size: 0.82rem;
}

.nx-chart {
    position: relative;
    min-height: 240px;
}

.content-wrapper,
.wrapper {
    overflow-x: hidden;
}

.nx-cal,
.nx-cal-head {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 0.35rem;
}

.nx-cal-head {
    margin-bottom: 0.35rem;
    color: var(--nx-muted);
    font-size: 0.75rem;
    text-align: center;
}

.nx-cal-day {
    min-height: 5.4rem;
    border: 1px solid var(--nx-line);
    border-radius: 8px;
    padding: 0.35rem;
    background: #fff;
    color: inherit;
    display: flex;
    flex-direction: column;
    text-decoration: none;
}

.nx-day-past { background: #f8fafc; }
.nx-day-sunday { background: #eef2ff; }
.nx-day-corporate, .nx-day-red { background: #fee2e2; border-color: #f87171; }
.nx-day-red .nx-holiday-name, .nx-day-red .nx-leave-name { color: #991b1b; font-weight: 600; }
.nx-leave-name { display: block; font-size: 0.68rem; line-height: 1.15; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nx-cal-legend { color: #475569; font-size: 0.9rem; }
.nx-swatch { display: inline-block; width: 0.75rem; height: 0.75rem; border-radius: 2px; margin-right: 0.35rem; vertical-align: -1px; }
.nx-swatch-red { background: #dc2626; }
.nx-day-optional { background: #f8fafc; border-style: dashed; }
.nx-day-today { box-shadow: inset 0 0 0 2px #0f766e; }
.nx-cal-num { font-weight: 700; }
.nx-holiday-name { display: block; font-size: 0.68rem; line-height: 1.15; color: #9a3412; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nx-day-optional .nx-holiday-name, .nx-day-sunday .nx-holiday-name { color: #475569; }
.nx-day-corporate .nx-holiday-name { color: #9a3412; font-weight: 600; }
.nx-day-selected { outline: 2px solid #0369a1; }
.nx-cross { color: #94a3b8; font-weight: 700; margin-left: 0.15rem; }
.nx-dots { margin-top: auto; display: flex; gap: 3px; flex-wrap: wrap; }
.nx-dot { width: 7px; height: 7px; border-radius: 99px; display: inline-block; }
.nx-dot-close { background: #0f766e; }
.nx-dot-visit { background: #0369a1; }
.nx-dot-follow { background: #d97706; }
.nx-dot-deadline { background: #b91c1c; }
.nx-dot-event { background: #7c3aed; }
.nx-dot-holiday { background: #b45309; }
.nx-dot-leave { background: #be185d; }
.nx-permission { border-top: 1px solid var(--nx-line); padding-top: 0.8rem; margin-top: 0.8rem; }
.nx-permission:first-child { border-top: 0; padding-top: 0; margin-top: 0; }
.nx-depend { color: var(--nx-muted); font-size: 0.85rem; }
.form-group:has(input[required]) > label::after,
.form-group:has(select[required]) > label::after,
.form-group:has(textarea[required]) > label::after,
label.d-block:has(input[required])::after {
    content: " *";
    color: #dc2626;
    font-weight: 700;
}
.nx-client-count {
    display: inline-flex;
    min-width: 2.1rem;
    justify-content: center;
    align-items: center;
    padding: 0.15rem 0.55rem;
    border-radius: 999px;
    background: #0f766e;
    color: #fff;
    font-weight: 700;
}
.nx-service-table th,
.nx-service-table td { vertical-align: middle; }
@media (max-width: 767.98px) {
    .nx-service-table { font-size: 0.85rem; }
    .nx-client-count { min-width: 1.8rem; }
}

@media (max-width: 767.98px) {
    .nx-page-head {
        flex-direction: column;
        align-items: flex-start;
    }

    .nx-stat strong {
        font-size: 1.45rem;
    }

    .nx-cal-day {
        min-height: 3.1rem;
        padding: 0.2rem;
    }

    .nx-auth-box,
    .nx-auth-box-wide,
    .login-box {
        width: 92%;
        margin-top: 1.5rem;
    }
}
.nx-state { font-weight: 700; }
.nx-state-open { color: #15803d; }
.nx-state-pending { color: #c2410c; }
.nx-state-locked { color: #b91c1c; }
.nx-pace { display: inline-block; padding: 0.2rem 0.65rem; border-radius: 999px; font-weight: 700; font-size: 0.85rem; }
.nx-pace-completed, .nx-pace-ahead, .nx-pace-track { background: #dcfce7; color: #166534; }
.nx-pace-behind { background: #ffedd5; color: #9a3412; }
.nx-pace-risk { background: #fee2e2; color: #991b1b; }
.nx-remaining-figure { color: #0f2744; }

.nx-contact-editor,
.nx-contact-mobile-card {
    border: 1px solid #d8dee6;
    border-radius: 0.5rem;
    padding: 0.9rem 0.9rem 0.2rem;
    margin-bottom: 0.9rem;
    background: #fff;
}
.nx-contact-mobile-card { padding-bottom: 0.9rem; }
.nx-contact-editor.is-primary,
.nx-contact-mobile-card.is-primary {
    border-color: #0f766e;
    box-shadow: inset 3px 0 0 #0f766e;
    background: #f0fdfa;
}
.nx-contact-editor .nx-primary-badge { display: none; }
.nx-contact-editor.is-primary .nx-primary-badge { display: inline-block; }
.nx-primary-badge,
.nx-badge-primary {
    background: #0f766e;
    color: #fff;
}
.nx-contact-table tr.is-primary td { background: #f0fdfa; }
.nx-contact-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
}
.nx-contact-actions form { margin: 0; }
@media (max-width: 767.98px) {
    .nx-contact-editor { padding: 0.75rem 0.75rem 0.1rem; }
}
