:root {
    --cx-match-navy-1: #08162e;
    --cx-match-navy-2: #0c2448;
    --cx-match-navy-3: #123564;
    --cx-match-blue: #2563eb;
    --cx-match-blue-strong: #1d4ed8;
    --cx-match-line: rgba(255,255,255,.11);
    --cx-match-border: #dce6f4;
    --cx-match-card: #ffffff;
    --cx-match-surface: #f4f7fc;
    --cx-match-text: #10213f;
    --cx-match-muted: #7082a0;
    --cx-match-green: #22c55e;
}

body.cx-admin-body {
    background: linear-gradient(180deg, #f8fbff 0%, #f2f6fc 100%) !important;
    color: var(--cx-match-text);
}

body.cx-admin-body .cx-admin-shell {
    min-height: 100vh;
    background: transparent;
}

/* ===== SIDEBAR ===== */
body.cx-admin-body .vm-sidebar.cx-sidebar {
    width: 318px !important;
    background:
        radial-gradient(circle at 16% 4%, rgba(59,130,246,.25), transparent 28%),
        radial-gradient(circle at 85% 14%, rgba(16,185,129,.08), transparent 18%),
        linear-gradient(180deg, var(--cx-match-navy-1) 0%, var(--cx-match-navy-2) 38%, #071525 100%) !important;
    border-right: 1px solid rgba(255,255,255,.06);
    box-shadow: 16px 0 40px rgba(8, 19, 40, .20) !important;
}

body.cx-admin-body .cx-sidebar-header {
    padding: 18px 20px 14px !important;
    min-height: auto !important;
    border-bottom: 1px solid rgba(255,255,255,.05);
}

body.cx-admin-body .cx-brand {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    padding: 12px 10px 10px !important;
    border: 0 !important;
    border-radius: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
}

body.cx-admin-body .cx-brand img {
    height: 58px !important;
    width: auto;
    object-fit: contain;
    filter: drop-shadow(0 10px 18px rgba(0,0,0,.20));
}

body.cx-admin-body .cx-menu-tools {
    padding: 0 18px 16px !important;
    border-bottom: 1px solid rgba(255,255,255,.06);
}

body.cx-admin-body .cx-menu-level {
    display: inline-flex;
    align-items: center;
    margin-bottom: 12px;
    padding: 7px 12px;
    border: 1px solid rgba(111, 183, 255, .15);
    border-radius: 999px;
    background: rgba(88, 147, 255, .12);
    color: #d7e8ff;
    font-size: .74rem;
    font-weight: 800;
    letter-spacing: .02em;
}

body.cx-admin-body .cx-menu-search {
    min-height: 52px;
    padding: 0 14px;
    border: 1px solid rgba(255,255,255,.12);
    border-radius: 16px;
    background: rgba(255,255,255,.045);
    box-shadow: inset 0 1px 0 rgba(255,255,255,.04);
    color: #c8dbf7;
}

body.cx-admin-body .cx-menu-search > span {
    font-size: 1rem;
    opacity: .9;
}

body.cx-admin-body .cx-menu-search input {
    min-height: 50px;
    font-size: .95rem;
    color: #f5f8ff;
}

body.cx-admin-body .cx-menu-search input::placeholder {
    color: #9eb2cf;
}

body.cx-admin-body .cx-menu-shortcuts {
    gap: 8px;
    margin-top: 12px;
}

body.cx-admin-body .cx-menu-shortcuts button {
    min-height: 46px;
    border: 1px solid rgba(255,255,255,.12);
    border-radius: 14px;
    background: rgba(255,255,255,.035);
    color: #e4efff;
    font-size: .9rem;
    font-weight: 750;
}

body.cx-admin-body .cx-sidebar-scroll {
    padding: 14px 14px 18px !important;
}

body.cx-admin-body .cx-menu-section + .cx-menu-section {
    margin-top: 18px;
    padding-top: 16px;
    border-top: 1px solid rgba(255,255,255,.07);
}

body.cx-admin-body .cx-menu-section-heading {
    padding: 0 8px 10px;
}

body.cx-admin-body .cx-menu-section-heading > span {
    color: #c7d8f7;
    font-size: .73rem;
    font-weight: 850;
    letter-spacing: .1em;
}

body.cx-admin-body .cx-menu-section-heading small {
    color: #86a0c4;
    font-size: .77rem;
}

body.cx-admin-body .cx-menu-home,
body.cx-admin-body .cx-menu-group > summary,
body.cx-admin-body .cx-menu-link {
    border-radius: 16px;
}

body.cx-admin-body .cx-menu-home {
    min-height: 52px;
    margin-bottom: 8px;
    padding: 13px 14px;
    color: #e7f0ff;
    background: rgba(255,255,255,.03);
    border: 1px solid transparent;
}

body.cx-admin-body .cx-menu-home > span {
    display: inline-grid;
    place-items: center;
    width: 22px;
    color: #8bb8ff;
    font-size: .95rem;
}

body.cx-admin-body .cx-menu-group {
    margin: 0 0 8px;
}

body.cx-admin-body .cx-menu-group > summary {
    min-height: 58px;
    padding: 14px 14px;
    border: 1px solid transparent;
    background: rgba(255,255,255,.03);
    color: #ebf3ff;
    font-size: 1rem;
    font-weight: 750;
    transition: background-color .18s ease, border-color .18s ease, transform .18s ease, box-shadow .18s ease;
}

body.cx-admin-body .cx-menu-group > summary:hover,
body.cx-admin-body .cx-menu-home:hover,
body.cx-admin-body .cx-menu-link:hover {
    background: rgba(255,255,255,.06);
    border-color: rgba(255,255,255,.07);
    color: #fff;
}

body.cx-admin-body .cx-menu-group[open] > summary {
    background: linear-gradient(180deg, rgba(255,255,255,.08), rgba(255,255,255,.045));
    border-color: rgba(78, 151, 255, .22);
    box-shadow: 0 12px 24px rgba(5, 16, 32, .18);
}

body.cx-admin-body .cx-menu-icon {
    display: inline-grid;
    place-items: center;
    width: 22px;
    color: #8eb8ff;
    font-size: 1rem;
}

body.cx-admin-body .cx-menu-chevron {
    color: #8ea6c8;
    font-size: 1.15rem;
}

body.cx-admin-body .cx-menu-items {
    display: grid;
    gap: 6px;
    margin: 8px 2px 2px 18px;
    padding: 10px 0 2px 16px;
    border-left: 1px solid rgba(255,255,255,.10);
}

body.cx-admin-body .cx-menu-link {
    min-height: 44px;
    padding: 11px 14px;
    color: #cfddf3;
    font-size: .92rem;
    font-weight: 650;
    background: transparent;
    border: 1px solid transparent;
}

body.cx-admin-body .cx-menu-home.active,
body.cx-admin-body .cx-menu-link.active {
    color: #fff;
    background: linear-gradient(135deg, #2970f5 0%, #1f55cf 100%);
    border-color: rgba(123, 181, 255, .24);
    box-shadow: 0 12px 24px rgba(20, 77, 190, .28);
}

body.cx-admin-body .cx-sidebar-footer {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 14px;
    padding: 16px 16px !important;
    border: 1px solid rgba(255,255,255,.08);
    border-radius: 20px;
    background: linear-gradient(180deg, rgba(13, 36, 69, .88), rgba(10, 28, 55, .88));
    box-shadow: inset 0 1px 0 rgba(255,255,255,.05);
}

body.cx-admin-body .cx-sidebar-footer strong {
    display: block;
    color: #f7fbff;
    font-size: 1.02rem;
}

body.cx-admin-body .cx-sidebar-footer span {
    color: #9eb3d2;
    font-size: .83rem;
}

body.cx-admin-body .cx-sidebar-footer-mark {
    width: 44px !important;
    height: 44px !important;
    border-radius: 14px !important;
    background: linear-gradient(135deg, #14b8a6, #2563eb) !important;
    color: #fff;
    box-shadow: 0 14px 24px rgba(37,99,235,.28);
}

/* ===== TOPBAR ===== */
body.cx-admin-body .vm-main.cx-main {
    background: transparent;
}

body.cx-admin-body .vm-topbar.cx-topbar {
    position: sticky;
    top: 0;
    z-index: 1030;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    min-height: 88px !important;
    padding: 14px 24px !important;
    background: linear-gradient(90deg, #0b2a58 0%, #143f76 100%) !important;
    border-bottom: 1px solid rgba(255,255,255,.08) !important;
    box-shadow: 0 10px 30px rgba(8, 19, 40, .12) !important;
    backdrop-filter: blur(12px);
}

body.cx-admin-body .cx-topbar-primary {
    display: flex;
    align-items: center;
    gap: 16px;
    min-width: 0;
    flex: 1 1 auto;
}

body.cx-admin-body .cx-topbar-left {
    display: flex;
    align-items: center;
    gap: 14px;
    min-width: 0;
    flex: 1 1 560px;
}

body.cx-admin-body .cx-menu-button {
    width: 44px;
    height: 44px;
    border: 1px solid rgba(255,255,255,.14);
    border-radius: 14px;
    background: rgba(255,255,255,.08);
    color: #fff;
    box-shadow: inset 0 1px 0 rgba(255,255,255,.03);
}

body.cx-admin-body .cx-topbar-search {
    display: flex;
    align-items: center;
    gap: 10px;
    width: min(100%, 560px);
    min-height: 54px;
    padding: 0 14px;
    border: 1px solid rgba(255,255,255,.15);
    border-radius: 16px;
    background: rgba(255,255,255,.96);
    box-shadow: 0 10px 24px rgba(4, 14, 29, .12);
}

body.cx-admin-body .cx-topbar-search-icon {
    flex: 0 0 auto;
    color: #6b82a3;
    font-size: 1rem;
}

body.cx-admin-body .cx-topbar-search input {
    min-width: 0;
    flex: 1 1 auto;
    height: 52px;
    border: 0;
    outline: 0;
    background: transparent;
    color: #173153;
    font-size: .98rem;
    font-weight: 500;
}

body.cx-admin-body .cx-topbar-search input::placeholder {
    color: #7184a2;
}

body.cx-admin-body .cx-topbar-search-shortcut {
    flex: 0 0 auto;
    padding: 7px 11px;
    border: 1px solid #d7e3f1;
    border-radius: 10px;
    background: #f7faff;
    color: #5f7395;
    font-size: .82rem;
    font-weight: 800;
    line-height: 1;
}

body.cx-admin-body .cx-topbar-page-marker {
    min-width: 0;
    flex: 0 1 280px;
    padding-left: 8px;
    border-left: 1px solid rgba(255,255,255,.16);
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 2px;
}

body.cx-admin-body .cx-topbar-page-marker span {
    color: rgba(224,235,255,.76);
    font-size: .78rem;
    font-weight: 800;
    letter-spacing: .12em;
    text-transform: uppercase;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

body.cx-admin-body .cx-topbar-page-marker strong {
    color: #ffffff;
    font-size: 1.15rem;
    font-weight: 850;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

body.cx-admin-body .vm-topbar-actions.cx-topbar-actions {
    flex: 0 0 auto;
    align-items: center;
}

body.cx-admin-body .cx-account-context {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0;
    border: 0 !important;
    border-radius: 18px !important;
    background: transparent !important;
    box-shadow: none !important;
}

body.cx-admin-body :is(.cx-branch-context, .cx-user-button) {
    min-height: 64px !important;
    border: 1px solid rgba(255,255,255,.14) !important;
    border-radius: 18px !important;
    background: rgba(255,255,255,.08) !important;
    box-shadow: inset 0 1px 0 rgba(255,255,255,.05);
}

body.cx-admin-body .cx-context-segment,
body.cx-admin-body .cx-branch-context,
body.cx-admin-body .cx-user-button {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
}

body.cx-admin-body .cx-branch-context {
    min-width: 280px;
}

body.cx-admin-body .cx-context-icon,
body.cx-admin-body .cx-user-avatar {
    width: 44px;
    height: 44px;
    display: inline-grid;
    place-items: center;
    border-radius: 14px !important;
    background: linear-gradient(180deg, rgba(255,255,255,.18), rgba(255,255,255,.10));
    color: #ffffff;
    font-weight: 800;
    flex: 0 0 auto;
}

body.cx-admin-body .cx-context-copy,
body.cx-admin-body .cx-user-copy {
    display: flex;
    flex-direction: column;
    min-width: 0;
    flex: 1 1 auto;
    color: #fff;
}

body.cx-admin-body .cx-context-copy small,
body.cx-admin-body .cx-user-copy small {
    color: rgba(223,233,251,.78);
    font-size: .73rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: .08em;
}

body.cx-admin-body .cx-context-copy strong,
body.cx-admin-body .cx-user-copy strong {
    color: #fff;
    font-size: 1.05rem;
    font-weight: 800;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

body.cx-admin-body .cx-user-copy em {
    color: rgba(223,233,251,.72);
    font-size: .82rem;
    font-style: normal;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

body.cx-admin-body .cx-context-select {
    width: 100%;
    margin-top: 3px;
    padding: 0;
    border: 0;
    background: transparent;
    color: #fff;
    font-weight: 800;
    font-size: 1.03rem;
    box-shadow: none;
    outline: 0;
}

body.cx-admin-body .cx-context-select option {
    color: #0f2340;
}

body.cx-admin-body .cx-context-arrow {
    color: rgba(255,255,255,.72);
    font-size: .92rem;
}

body.cx-admin-body .cx-top-icon-button {
    position: relative;
    display: inline-grid;
    place-items: center;
    width: 54px;
    height: 54px;
    border: 1px solid rgba(255,255,255,.14);
    border-radius: 16px;
    background: rgba(255,255,255,.08);
    color: #fff;
    box-shadow: inset 0 1px 0 rgba(255,255,255,.05);
}

body.cx-admin-body .cx-top-icon-button span {
    font-size: 1.05rem;
    line-height: 1;
}

body.cx-admin-body .cx-top-icon-button small {
    position: absolute;
    top: 11px;
    right: 11px;
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: #ff4d4f;
    box-shadow: 0 0 0 3px rgba(11, 42, 88, 1);
}

body.cx-admin-body .cx-user-dropdown .dropdown-menu {
    margin-top: 12px;
    border: 1px solid #dbe6f4;
    border-radius: 18px;
}

/* ===== CONTENT ===== */
body.cx-admin-body .cx-content {
    min-height: calc(100vh - 88px);
    padding: 24px 26px 34px !important;
    background:
        radial-gradient(circle at 100% 0%, rgba(37, 99, 235, .05), transparent 20%),
        linear-gradient(180deg, #f8fbff 0%, #f2f6fc 100%) !important;
}

/* Tables and cards integrate better with premium shell */
body.cx-admin-body .cx-content :is(.card, .erp-panel, .table-responsive, .vm-card) {
    border-color: #e0e8f4;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 1399.98px) {
    body.cx-admin-body .cx-topbar-page-marker {
        display: none !important;
    }
}

@media (max-width: 1199.98px) {
    body.cx-admin-body .cx-branch-context {
        min-width: 230px;
    }

    body.cx-admin-body .cx-context-copy strong,
    body.cx-admin-body .cx-user-copy strong {
        font-size: .98rem;
    }
}

@media (max-width: 991.98px) {
    body.cx-admin-body .vm-sidebar.cx-sidebar {
        width: min(86vw, 320px) !important;
        border-radius: 0 26px 26px 0;
    }

    body.cx-admin-body .vm-topbar.cx-topbar {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
        padding: 12px 14px !important;
    }

    body.cx-admin-body .cx-topbar-primary,
    body.cx-admin-body .cx-topbar-left,
    body.cx-admin-body .vm-topbar-actions.cx-topbar-actions,
    body.cx-admin-body .cx-account-context {
        width: 100%;
    }

    body.cx-admin-body .cx-topbar-left {
        flex: 1 1 auto;
    }

    body.cx-admin-body .cx-topbar-search {
        width: 100%;
    }

    body.cx-admin-body .cx-account-context {
        display: grid;
        grid-template-columns: minmax(0, 1fr);
        gap: 10px;
    }

    body.cx-admin-body .cx-branch-context,
    body.cx-admin-body .cx-user-button {
        min-width: 0;
        width: 100%;
    }

    body.cx-admin-body .cx-top-icon-button {
        display: none;
    }

    body.cx-admin-body .cx-content {
        padding: 18px 14px 26px !important;
    }
}

@media (max-width: 575.98px) {
    body.cx-admin-body .cx-brand img {
        height: 52px !important;
    }

    body.cx-admin-body .cx-topbar-search {
        min-height: 50px;
        padding: 0 10px 0 12px;
    }

    body.cx-admin-body .cx-topbar-search input {
        height: 48px;
        font-size: .92rem;
    }

    body.cx-admin-body .cx-topbar-search-shortcut {
        padding: 6px 8px;
        font-size: .76rem;
    }

    body.cx-admin-body .cx-menu-group > summary,
    body.cx-admin-body .cx-menu-home {
        min-height: 54px;
        padding: 12px 13px;
    }

    body.cx-admin-body .cx-menu-link {
        padding: 10px 12px;
        font-size: .9rem;
    }
}
