:root {
    --ez-new-sidebar-width: 214px;
    --ez-new-sidebar-mini-width: 86px;
    --ez-new-topbar-height: 60px;
    --ez-new-border: #e3e9f5;
    --ez-new-muted: #64748b;
    --ez-new-bg: #f5f9ff;
    --ez-new-primary: #6a1ed7;
    --ez-sidebar-gradient: linear-gradient(180deg, #ffffff 0%, #ffffff 42%, rgba(106, 30, 215, 0.50) 100%);
}

body.ez-new-dashboard-page .topbar {
    background: #ffffff !important;
    border-bottom: 1px solid #e6edf8;
    z-index: 5000 !important;
    overflow: visible !important;
}

body.ez-new-dashboard-page .topbar .navbar-custom,
body.ez-new-dashboard-page .topbar .topbar-custom,
body.ez-new-dashboard-page .topbar .nav-item,
body.ez-new-dashboard-page .topbar .dropdown {
    overflow: visible !important;
}

body.ez-new-dashboard-page .topbar .dropdown-menu {
    z-index: 5100 !important;
}

body.ez-new-dashboard-page .topbar .dropdown:has(.dropdown-menu.show) {
    position: relative !important;
    z-index: 5100 !important;
}

body.ez-new-dashboard-page .topbar-custom {
    min-height: var(--ez-new-topbar-height);
    gap: 8px;
    padding-right: 8px;
}

body.ez-new-dashboard-page .topbar-plan {
    display: none !important;
}

body.ez-new-dashboard-page .topbar-ai-assistant-item {
    display: inline-flex;
}

body.ez-new-dashboard-page .topbar-ai-assistant {
    width: auto;
    min-width: 0;
    height: auto;
    min-height: 31px;
    padding: 5px 11px;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    border: 1px solid #d9c8ff;
    border-radius: 12px;
    color: #ffffff;
    font-size: 10px;
    font-weight: 700;
    text-decoration: none;
    background: linear-gradient(90deg, rgba(86, 139, 243, 0.55) 0%, rgba(106, 30, 215, 0.55) 50%, rgba(234, 97, 212, 0.55) 100%);
    box-shadow: 0 10px 20px rgba(118, 67, 224, 0.22);
}

body.ez-new-dashboard-page .topbar-ai-assistant i {
    font-size: 14px;
}

body.ez-new-dashboard-page .topbar-ai-assistant:hover {
    color: #ffffff;
    opacity: 0.96;
}

body.ez-new-dashboard-page .topbar-profile-trigger {
    min-height: 36px;
    padding: 3px 8px 3px 5px;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    border: 1px solid #e5eaf4;
    border-radius: 12px;
    color: #1f2937;
    text-decoration: none;
    background: #ffffff;
}

body.ez-new-dashboard-page .topbar-profile-trigger::after {
    margin-left: 6px;
    color: #6b7280;
}

body.ez-new-dashboard-page .topbar-profile-avatar,
body.ez-new-dashboard-page .topbar-profile-fallback {
    width: 26px;
    height: 26px;
    border-radius: 50%;
}

body.ez-new-dashboard-page .topbar-profile-fallback {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    font-size: 14px;
    font-weight: 700;
    background: linear-gradient(145deg, #3b82f6 0%, #6d2ee8 100%);
}

body.ez-new-dashboard-page .topbar-profile-text {
    display: inline-flex;
    flex-direction: column;
    line-height: 1.1;
}

body.ez-new-dashboard-page .topbar-profile-name {
    font-size: 12px;
    font-weight: 700;
    color: #111827;
}

body.ez-new-dashboard-page .topbar-profile-text small {
    color: #8b93a2;
    font-size: 10px;
    font-weight: 500;
}

html body .topbar {
    left: var(--ez-new-sidebar-width) !important;
    width: calc(100% - var(--ez-new-sidebar-width)) !important;
}

html body .page-wrapper .page-content.ms-0 {
    width: calc(100% - var(--ez-new-sidebar-width));
    margin-left: var(--ez-new-sidebar-width) !important;
    padding-left: 0;
    padding-right: 0;
    background: var(--ez-new-bg);
}

html body .page-wrapper .page-content.ms-0 > .mt-3 {
    margin-top: 0 !important;
}

.ez-new-layout {
    min-height: calc(100vh - var(--ez-new-topbar-height));
}

.ez-new-sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 1050;
    width: var(--ez-new-sidebar-width);
    display: flex;
    flex-direction: column;
    background: var(--ez-sidebar-gradient);
    border-right: 1px solid var(--ez-new-border);
    overflow-y: auto;
    transition: transform .25s ease;
}

.ez-new-sidebar::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 46%;
    display: none;
    pointer-events: none;
    z-index: 0;
}

.ez-new-sidebar > * {
    position: relative;
    z-index: 1;
}

body.ez-new-dashboard-page .topbar .brand {
    display: none;
}

body.ez-new-dashboard-page .topbar-custom {
    justify-content: flex-end !important;
}

.ez-new-sidebar-toggle {
    position: fixed;
    top: 12px;
    left: calc(var(--ez-new-sidebar-width) + 12px);
    z-index: 1060;
    width: 36px;
    height: 36px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid transparent;
    border-radius: 8px;
    color: #4b5565;
    background: transparent;
    font-size: 22px;
    transition: left .25s ease, color .15s ease, background .15s ease;
}

.ez-new-sidebar-toggle:hover {
    color: var(--ez-new-primary);
    background: #eef3ff;
}

.ez-new-brand {
    height: var(--ez-new-topbar-height);
    padding: 0 12px;
    display: flex;
    align-items: center;
    gap: 8px;
    border-bottom: 1px solid var(--ez-new-border);
    color: #151b2b;
    font-size: 28px;
    font-weight: 700;
    text-decoration: none;
}

.ez-new-brand:hover {
    color: #151b2b;
}

.ez-new-brand img {
    width: 23px;
    height: 23px;
    object-fit: contain;
}

.ez-new-nav {
    flex: 1 1 auto;
    padding: 10px 8px 16px;
}

.ez-new-nav-group + .ez-new-nav-group {
    margin-top: 12px;
}

.ez-new-nav-heading {
    width: 100%;
    margin: 0 0 7px;
    padding: 3px 9px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border: 0;
    color: #737b8f;
    background: transparent;
    font-size: 12px;
    line-height: 1;
    letter-spacing: .02em;
    text-align: left;
}

.ez-new-nav-group:first-child .ez-new-nav-heading {
    min-height: 38px;
    margin-bottom: 10px;
    padding: 8px 11px;
    border-radius: 10px;
    color: #ffffff;
    background: linear-gradient(90deg, #6a2be8 0%, #7f41f2 100%);
    font-size: 14px;
    font-weight: 600;
}

.ez-new-nav-group:first-child .ez-new-nav-heading i {
    color: #ffffff;
}

.ez-new-nav-heading i {
    font-size: 13px;
    transition: transform .2s ease;
}

.ez-new-nav-heading:hover {
    color: var(--ez-new-primary);
}

.ez-new-nav-items {
    overflow: visible;
    opacity: 1;
}

.ez-new-nav-group.is-collapsed .ez-new-nav-items {
    display: none;
}

.ez-new-nav-group.is-collapsed .ez-new-nav-heading i {
    transform: rotate(-90deg);
}

.ez-new-nav-link {
    min-height: 38px;
    padding: 8px 10px;
    display: flex;
    align-items: center;
    gap: 8px;
    border-radius: 9px;
    color: #596176;
    font-size: 12px;
    font-weight: 500;
    text-decoration: none;
    transition: color .15s ease, background .15s ease;
}

.ez-new-nav-link i {
    width: 18px;
    font-size: 14px;
    color: #8d95a8;
    text-align: center;
}

.ez-new-nav-link:hover,
.ez-new-nav-link.active {
    color: #4f6ef2;
    background: #edf2ff;
}

.ez-new-nav-link:hover i,
.ez-new-nav-link.active i {
    color: #5f7af5;
}

.ez-new-nav-link.active {
    font-weight: 700;
    position: relative;
}

.ez-new-nav-link.active::before {
    display: none;
}

.ez-new-main {
    width: 100%;
    min-height: calc(100vh - var(--ez-new-topbar-height));
    padding: 14px 14px 20px;
}

.ez-new-main .ez-dashboard {
    font-family: "Nunito", "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
}

.ez-new-sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 1040;
    padding: 0;
    border: 0;
    background: rgba(15, 23, 42, .45);
}

/* New dashboard */
.ez-dashboard {
    max-width: 1260px;
    margin: 0 auto;
}

.ez-metric-card {
    height: 100%;
    min-height: 112px;
    padding: 17px 18px;
    border: 1px solid #d9dee7;
    border-radius: 9px;
    background: var(--bs-card-bg, #fff);
    box-shadow: 0 2px 8px rgba(24, 39, 75, .025);
}

.ez-metric-value {
    font-size: 26px;
    line-height: 1;
    font-weight: 750;
}

.ez-metric-label {
    margin-top: 19px;
    color: var(--ez-new-muted);
    font-size: 12px;
}

.ez-metric-icon {
    width: 34px;
    height: 34px;
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

/* Summary icon background */
.ez-metric-icon {
    width: 42px;
    height: 38px;
    position: relative;

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

    flex-shrink: 0;
}

/* Purple blob - right/top */
.ez-metric-icon::before {
    content: "";
    position: absolute;

    top: 0;
    right: -2px;

    width: 34px;
    height: 30px;

    background: url('../fonts/icons/Group%201000002746.svg')
        center / contain no-repeat;

    opacity: 0.95;
    pointer-events: none;
    z-index: 0;
}

/* Actual document icon */
.ez-metric-icon-img {
    width: 15px;
    height: 15px;

    object-fit: contain;
    display: block;

    position: relative;
    z-index: 2;
}

.ez-dashboard .ez-metric-icon-img {
    width: 15px;
    height: 15px;
    object-fit: contain;
    display: block;
    position: relative;
    z-index: 2;
}



.ez-tone-black { color: #111827; }
.ez-tone-orange { color: #ff5b13; }
.ez-tone-green { color: #08a83e; }
.ez-tone-pink { color: #ec16e9; }
.ez-tone-blue { color: #1348e8; }
.ez-tone-red { color: #e11919; }

.ez-recent-card {
    margin-top: 28px;
    overflow: hidden;
    border: 1px solid #d9dee7;
    border-radius: 10px;
    background: var(--bs-card-bg, #fff);
}

.ez-recent-header {
    padding: 15px 17px 12px;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 20px;
}

.ez-recent-title {
    margin: 0;
    color: var(--bs-heading-color, #1f2937);
    font-size: 18px;
    font-weight: 700;
}

.ez-recent-subtitle {
    margin: 2px 0 0;
    color: var(--ez-new-muted);
    font-size: 11px;
}

.ez-view-all {
    padding: 5px 12px;
    border: 1px solid #d4dae3;
    border-radius: 7px;
    color: #202735;
    background: #fff;
    font-size: 11px;
    text-decoration: none;
    white-space: nowrap;
}

.ez-view-all:hover {
    color: var(--ez-new-primary);
    border-color: var(--ez-new-primary);
}

.ez-document-table {
    width: 100%;
    margin: 0;
    border-collapse: collapse;
}

.ez-document-table th {
    padding: 12px 13px;
    border: 0;
    background: #f1f2f4;
    color: #6d7480;
    font-size: 10px;
    font-weight: 500;
    white-space: nowrap;
}

.ez-document-table td {
    padding: 14px 13px;
    border-top: 1px solid #e4e7ec;
    color: var(--bs-body-color, #202735);
    font-size: 11px;
    vertical-align: middle;
}

.ez-document-title {
    min-width: 230px;
    max-width: 340px;
    overflow: hidden;
    color: var(--bs-heading-color, #111827);
    font-weight: 650;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ez-avatar-stack {
    display: flex;
    align-items: center;
}

.ez-mini-avatar {
    width: 23px;
    height: 23px;
    margin-left: -5px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 2px solid #fff;
    border-radius: 50%;
    color: #fff;
    background: #12a586;
    font-size: 8px;
    font-weight: 700;
}


.ez-mini-avatar:first-child {
    margin-left: 0;
}


.ez-mini-avatar.pending {
    background: #ff650f;
}


.ez-status {
    padding: 3px 7px;
    display: inline-flex;
    border-radius: 3px;
    color: #fff;
    font-size: 9px;
    font-weight: 700;
    white-space: nowrap;
}


.ez-status.signed,
.ez-status.approved { background: #08a83e; }
.ez-status.completed { background: #08a83e; }
.ez-status.pending { background: #ff650f; }
.ez-status.in_progress { background: #0d6efd; }
.ez-status.cancelled { background: #e11919; }
.ez-status.declined { background: #e11919; }
.ez-status.expired { background: #6c757d; }

.ez-table-action {
    min-width: 26px;
    min-height: 24px;
    padding: 4px 7px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    border: 1px solid #d5dae2;
    border-radius: 4px;
    color: #323946;
    background: #fff;
    font-size: 9px;
    text-decoration: none;
    white-space: nowrap;
}

.ez-table-action.primary {
    border-color: var(--ez-new-primary);
    color: #fff;
    background: var(--ez-new-primary);
}

.ez-empty-state {
    padding: 42px 20px !important;
    color: var(--ez-new-muted) !important;
    text-align: center;
}

[data-bs-theme="dark"] .ez-new-sidebar,
[data-bs-theme="dark"] .ez-view-all,
[data-bs-theme="dark"] .ez-table-action {
    background: var(--bs-secondary-bg);
    color: var(--bs-body-color);
}

[data-bs-theme="dark"] .ez-new-brand,
[data-bs-theme="dark"] .ez-document-title {
    color: var(--bs-heading-color);
}

[data-bs-theme="dark"] .ez-new-sidebar-toggle {
    color: var(--bs-body-color);
}

[data-bs-theme="dark"] .ez-document-table th {
    background: rgba(255, 255, 255, .05);
}

@media (min-width: 992px) {
    body.ez-new-sidebar-collapsed .ez-new-sidebar {
        width: var(--ez-new-sidebar-mini-width);
        transform: translateX(0);
    }

    body.ez-new-sidebar-collapsed .topbar {
        left: var(--ez-new-sidebar-mini-width) !important;
        width: calc(100% - var(--ez-new-sidebar-mini-width)) !important;
    }

    body.ez-new-sidebar-collapsed .page-wrapper .page-content.ms-0 {
        width: calc(100% - var(--ez-new-sidebar-mini-width));
        margin-left: var(--ez-new-sidebar-mini-width) !important;
    }

    body.ez-new-sidebar-collapsed .ez-new-sidebar-toggle {
        left: calc(var(--ez-new-sidebar-mini-width) + 18px);
    }

    body.ez-new-sidebar-collapsed .ez-new-brand {
        padding: 0;
        justify-content: center;
    }

    body.ez-new-sidebar-collapsed .ez-new-brand > span {
        display: none;
    }

    body.ez-new-sidebar-collapsed .ez-new-brand img {
        width: 32px;
        height: 32px;
    }

    body.ez-new-sidebar-collapsed .ez-new-nav {
        padding: 17px 10px 28px;
    }

    body.ez-new-sidebar-collapsed .ez-new-nav-heading {
        display: none;
    }

    body.ez-new-sidebar-collapsed .ez-new-nav-group + .ez-new-nav-group {
        margin-top: 12px;
    }

    body.ez-new-sidebar-collapsed .ez-new-nav-items {
        display: block;
        overflow: visible;
        opacity: 1;
    }

    body.ez-new-sidebar-collapsed .ez-new-nav-link {
        padding: 10px;
        justify-content: center;
        gap: 0;
    }

    body.ez-new-sidebar-collapsed .ez-new-nav-link i {
        width: auto;
        font-size: 20px;
    }

    body.ez-new-sidebar-collapsed .ez-new-nav-link span {
        display: none;
    }
}

@media (max-width: 991.98px) {
    html body .topbar {
        left: 0 !important;
        width: 100% !important;
    }

    html body .page-wrapper .page-content.ms-0 {
        width: 100%;
        margin-left: 0 !important;
    }

    .ez-new-sidebar {
        transform: translateX(-100%);
        box-shadow: 12px 0 30px rgba(15, 23, 42, .12);
    }

    .ez-new-sidebar-toggle {
        left: 14px;
    }

    body.ez-new-sidebar-open .ez-new-sidebar {
        transform: translateX(0);
    }

    body.ez-new-sidebar-open .ez-new-sidebar-overlay {
        display: block;
    }

    .ez-new-main {
        padding: 18px 14px 28px;
    }
}

@media (max-width: 767.98px) {
    .ez-recent-card {
        overflow-x: auto;
    }

    .ez-document-table {
        min-width: 980px;
    }
}

/* Sidebar footer / user block */
.ez-new-sidebar-footer {
    margin-top: auto;
    padding: 12px 16px 16px;
}
.ez-sidebar-user {
    display: flex;
    align-items: center;
    gap: 12px;
}
.ez-sidebar-user-link {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
}
.ez-sidebar-avatar {
    width: 40px;
    height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: var(--ez-new-primary);
    color: #fff;
    font-weight: 700;
}
.ez-sidebar-user-name {
    font-size: 14px;
    font-weight: 600;
    color: #111827;
}
.ez-sidebar-user-role {
    font-size: 12px;
    color: var(--ez-new-muted);
}

.ez-sidebar-powered {
    margin-top: 8px;
    color: #7b7194;
    font-size: 11px;
    font-weight: 600;
}

.ez-sidebar-powered-brand {
    margin-top: 4px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: #111827;
    font-size: 17px;
    font-weight: 700;
}

.ez-sidebar-powered-brand img {
    width: 22px;
    height: 22px;
}

/* Support collapsed mini-sidebar */
body.ez-new-sidebar-collapsed .ez-new-sidebar-footer {
    padding: 10px 8px;
}
body.ez-new-sidebar-collapsed .ez-sidebar-user-info { display: none; }
body.ez-new-sidebar-collapsed .ez-sidebar-user { justify-content: center; }

/* Dark theme improvements for sidebar and main dashboard */
[data-bs-theme="dark"] .ez-new-sidebar {
    background: #0b1116;
    border-right-color: rgba(255,255,255,0.04);
}
[data-bs-theme="dark"] .ez-new-nav-heading,
[data-bs-theme="dark"] .ez-new-nav-items,
[data-bs-theme="dark"] .ez-new-nav {
    color: #9aa4b2;
}
[data-bs-theme="dark"] .ez-new-nav-link {
    color: #cbd5e1;
}
[data-bs-theme="dark"] .ez-new-nav-link:hover,
[data-bs-theme="dark"] .ez-new-nav-link.active {
    color: var(--ez-new-primary);
    background: rgba(49,103,243,0.10);
}
[data-bs-theme="dark"] .ez-new-sidebar-footer {
    border-top-color: rgba(255,255,255,0.02);
}
[data-bs-theme="dark"] .ez-sidebar-user-name { color: #e6eef8; }
[data-bs-theme="dark"] .ez-sidebar-user-role { color: #9ca3af; }
[data-bs-theme="dark"] .ez-new-main {
    background: #071021;
}

    

/* Dark theme overrides for AI nav group */

[data-bs-theme="dark"] .ez-nav-group-ai {
    border-color: rgba(168, 85, 247, 0.3);
    background: linear-gradient(135deg, rgba(147, 51, 234, 0.08) 0%, rgba(59, 130, 246, 0.08) 100%);
}

[data-bs-theme="dark"] .ez-nav-group-ai .ez-new-nav-heading {
    color: #c084fc !important;
}

[data-bs-theme="dark"] .ez-nav-group-ai .ez-new-nav-heading i {
    color: #c084fc;
}

[data-bs-theme="dark"] .ez-nav-group-ai .ez-new-nav-link {
    color: #cbd5e1;
}

[data-bs-theme="dark"] .ez-nav-group-ai .ez-new-nav-link:hover,
[data-bs-theme="dark"] .ez-nav-group-ai .ez-new-nav-link.active {
    color: #c084fc;
    background: rgba(168, 85, 247, 0.15);
}

/* Handle collapsed sidebar view gracefully */
@media (min-width: 992px) {
    body.ez-new-sidebar-collapsed .ez-nav-group-ai {
        border: none;
        background: transparent;
        padding: 0;
        margin-top: 12px;
        margin-bottom: 0;
    }
}
