/* Shared visual layer for the authenticated shell and embedded admin pages. */
body.admin-page,
body.admin-embedded-page,
body.text-center {
    --workspace-bg: var(--ui-page);
    --workspace-surface: var(--ui-surface);
    --workspace-ink: var(--ui-text);
    --workspace-muted: var(--ui-text-secondary);
    --workspace-line: var(--ui-border);
    --workspace-blue: var(--ui-blue-600);
    --workspace-teal: var(--ui-teal-600);
    --workspace-amber: var(--ui-warning);
    --workspace-red: var(--ui-danger);
}

body.admin-page,
body.admin-embedded-page {
    background: var(--ui-page) !important;
    color: var(--ui-text);
}

body.admin-page #app,
body.admin-embedded-page #app {
    background: var(--ui-page) !important;
}

/* Authenticated shell */
body.text-center[style*="overflow-y"] {
    background: var(--ui-page) !important;
}

body.text-center[style*="overflow-y"] #app {
    min-height: 100vh;
    background: var(--ui-page);
}

body.text-center[style*="overflow-y"] .mainLeftMenu {
    width: 232px !important;
    min-width: 232px !important;
    background: var(--ui-surface) !important;
    border-right: 1px solid var(--ui-border) !important;
    box-shadow: none !important;
}

body.text-center[style*="overflow-y"] .menuLeftLogo {
    min-height: 70px;
    padding: 16px 18px !important;
    border-bottom: 1px solid var(--ui-border) !important;
}

body.text-center[style*="overflow-y"] .mainMenuScroll {
    padding: 12px 0 18px;
}

body.text-center[style*="overflow-y"] .menuLeftItem {
    width: calc(100% - 24px) !important;
    height: 42px !important;
    margin: 3px 12px !important;
    border-radius: var(--ui-radius-sm) !important;
    color: var(--ui-text-secondary) !important;
    background: transparent !important;
}

body.text-center[style*="overflow-y"] .menuLeftItem i {
    color: var(--ui-blue-500) !important;
}

body.text-center[style*="overflow-y"] .menuLeftItem span,
body.text-center[style*="overflow-y"] .menuLeftItem span[slot="title"] {
    color: var(--ui-text) !important;
    font-size: 14px !important;
    font-weight: 550;
}

body.text-center[style*="overflow-y"] .menuLeftItem:hover {
    background: #f4f7fa !important;
}

body.text-center[style*="overflow-y"] .menuLeftItem.active {
    background: var(--ui-blue-100) !important;
}

body.text-center[style*="overflow-y"] .menuLeftItem.active i,
body.text-center[style*="overflow-y"] .menuLeftItem.active span,
body.text-center[style*="overflow-y"] .menuLeftItem.active span[slot="title"] {
    color: var(--ui-blue-600) !important;
}

body.text-center[style*="overflow-y"] .mainSubmenuItem.active {
    color: var(--ui-blue-600);
    background: #f2f6ff;
}

body.text-center[style*="overflow-y"] .mainRight {
    background: var(--ui-page) !important;
}

body.text-center[style*="overflow-y"] .adminTopbar {
    height: 60px;
    padding: 0 24px;
    background: rgba(255, 255, 255, .98) !important;
    border-bottom: 1px solid var(--ui-border) !important;
    box-shadow: none !important;
}

body.text-center[style*="overflow-y"] .adminBrandName {
    color: var(--ui-text);
    font-size: 16px;
    font-weight: 700;
}

body.text-center[style*="overflow-y"] .adminBrandMark {
    width: 30px;
    height: 30px;
    border-radius: 8px;
    background: var(--ui-blue-100);
    box-shadow: none;
}

body.text-center[style*="overflow-y"] .adminBreadcrumbSection {
    color: var(--ui-text-muted);
}

body.text-center[style*="overflow-y"] .adminBreadcrumbPage {
    color: var(--ui-text);
}

body.text-center[style*="overflow-y"] .adminSearchButton,
body.text-center[style*="overflow-y"] .adminTopbarIconButton,
body.text-center[style*="overflow-y"] .adminRefreshButton.el-button {
    border-color: var(--ui-border);
    border-radius: var(--ui-radius-sm);
    color: var(--ui-text-secondary);
    background: var(--ui-surface);
    box-shadow: none;
}

body.text-center[style*="overflow-y"] .adminSearchButton:hover,
body.text-center[style*="overflow-y"] .adminTopbarIconButton:hover,
body.text-center[style*="overflow-y"] .adminRefreshButton.el-button:hover {
    color: var(--ui-blue-600);
    border-color: #b8caf2;
    background: var(--ui-blue-100);
}

body.text-center[style*="overflow-y"] .adminHealth {
    border-color: #bfe8d8;
    background: var(--ui-success-bg);
    color: var(--ui-success);
    border-radius: var(--ui-radius-pill);
}

body.text-center[style*="overflow-y"] .adminContentViewport,
body.text-center[style*="overflow-y"] .mainIframe {
    background: var(--ui-page) !important;
}

body.text-center[style*="overflow-y"] .mainLeftMenu.collapsed {
    width: 64px !important;
    min-width: 64px !important;
}

/* Embedded management pages */
body.admin-page .mainMain,
body.admin-embedded-page .mainMain {
    background: transparent !important;
}

body.admin-page .el-card,
body.admin-page .adminCard,
body.admin-embedded-page .el-card,
body.admin-embedded-page .adminCard,
body.admin-page .el-table,
body.admin-embedded-page .el-table,
body.admin-page .el-tabs--border-card > .el-tabs__header,
body.admin-embedded-page .el-tabs--border-card > .el-tabs__header,
body.admin-page :is(.wo-layout, .lead-layout, .cq-layout, .roles-layout),
body.admin-embedded-page :is(.wo-layout, .lead-layout, .cq-layout, .roles-layout) {
    border-color: var(--ui-border) !important;
    border-radius: var(--ui-radius-md) !important;
    background: var(--ui-surface) !important;
    box-shadow: none !important;
}

body.admin-page :is(.lead-stat, .lead-insights, .lead-filters, .routing-section, .reception-auto-section, .reception-auto-rule, .oa-card, .wh-card, .rp-card, .deploy-card, .brand-card, .robot-setup-panel, .robot-setup-aside, .ai-config-card, .roles-compare-card, .air-metric),
body.admin-embedded-page :is(.lead-stat, .lead-insights, .lead-filters, .routing-section, .reception-auto-section, .reception-auto-rule, .oa-card, .wh-card, .rp-card, .deploy-card, .brand-card, .robot-setup-panel, .robot-setup-aside, .ai-config-card, .roles-compare-card, .air-metric) {
    background: var(--ui-surface) !important;
    border-color: var(--ui-border) !important;
    border-radius: var(--ui-radius-md) !important;
    box-shadow: none !important;
}

body.admin-page .el-table th.el-table__cell,
body.admin-embedded-page .el-table th.el-table__cell {
    color: var(--ui-text-secondary);
    background: var(--ui-surface-muted) !important;
    border-bottom-color: var(--ui-border);
}

body.admin-page .el-table td.el-table__cell,
body.admin-embedded-page .el-table td.el-table__cell {
    border-bottom-color: #e7eef1;
}

body.admin-page :is(.el-input__inner, .el-textarea__inner, .el-select .el-input__inner),
body.admin-embedded-page :is(.el-input__inner, .el-textarea__inner, .el-select .el-input__inner) {
    border-color: var(--ui-border);
    border-radius: var(--ui-radius-sm);
    color: var(--ui-text);
    background: var(--ui-surface);
}

body.admin-page :is(.el-input__inner, .el-textarea__inner):focus,
body.admin-embedded-page :is(.el-input__inner, .el-textarea__inner):focus {
    border-color: var(--ui-blue-500);
}

body.admin-page .el-button--primary,
body.admin-embedded-page .el-button--primary {
    border-color: var(--ui-blue-600);
    background: var(--ui-blue-600);
    border-radius: var(--ui-radius-sm);
}

body.admin-page .el-button--primary:hover,
body.admin-embedded-page .el-button--primary:hover {
    border-color: var(--ui-blue-500);
    background: var(--ui-blue-500);
}

body.admin-page .el-button--default,
body.admin-embedded-page .el-button--default {
    border-color: var(--ui-border);
    color: var(--ui-text-secondary);
    border-radius: var(--ui-radius-sm);
}

body.admin-page .el-tabs--border-card > .el-tabs__header .el-tabs__item.is-active,
body.admin-embedded-page .el-tabs--border-card > .el-tabs__header .el-tabs__item.is-active {
    color: var(--ui-blue-600);
    background: var(--ui-blue-100);
    box-shadow: inset 0 -2px var(--ui-blue-600);
}

body.admin-page :is(button, a, input, textarea, select):focus-visible,
body.admin-embedded-page :is(button, a, input, textarea, select):focus-visible {
    outline-color: var(--ui-blue-500);
}

@media (max-width: 900px) {
    body.text-center[style*="overflow-y"] .mainLeftMenu {
        width: 232px !important;
        min-width: 232px !important;
    }

    body.text-center[style*="overflow-y"] .adminTopbar {
        padding: 0 16px;
    }
}

/* Sidebar emphasis layer */
body.text-center[style*="overflow-y"] .mainLeftMenu {
    width: 248px !important;
    min-width: 248px !important;
    border-right-color: #cfdce5 !important;
    box-shadow: 6px 0 22px rgba(23, 43, 77, .06) !important;
}

body.text-center[style*="overflow-y"] .menuLeftLogo {
    min-height: 76px;
    padding: 17px 18px !important;
    background: linear-gradient(180deg, #ffffff 0%, #fbfdff 100%);
    border-bottom-color: #dfe8ee !important;
}

body.text-center[style*="overflow-y"] .menuLeftLogo .mainLogo {
    border: 3px solid #e8f0ff !important;
    box-shadow: 0 3px 10px rgba(62, 120, 232, .16) !important;
}

body.text-center[style*="overflow-y"] .userName {
    color: var(--ui-text) !important;
    font-size: 14px;
    font-weight: 700;
}

body.text-center[style*="overflow-y"] .userStatus {
    font-weight: 600;
}

body.text-center[style*="overflow-y"] .mainMenuScroll {
    padding: 16px 0 20px;
}

body.text-center[style*="overflow-y"] .mainMenuGroup + .mainMenuGroup {
    margin-top: 4px;
}

body.text-center[style*="overflow-y"] .menuLeftItem {
    width: calc(100% - 20px) !important;
    min-height: 48px !important;
    height: 48px !important;
    margin: 4px 10px !important;
    padding: 0 16px !important;
    border: 1px solid transparent;
    border-radius: 10px !important;
    color: var(--ui-text-secondary) !important;
    background: transparent !important;
    gap: 13px;
}

body.text-center[style*="overflow-y"] .menuLeftItem i {
    width: 22px !important;
    min-width: 22px !important;
    color: #6d84a0 !important;
    font-size: 18px !important;
}

body.text-center[style*="overflow-y"] .menuLeftItem .menuText,
body.text-center[style*="overflow-y"] .menuLeftItem .menuText > span,
body.text-center[style*="overflow-y"] .menuLeftItem .menuText > .el-badge {
    min-width: 0;
}

body.text-center[style*="overflow-y"] .menuLeftItem > .menuText {
    display: flex;
    flex: 1;
    align-items: center;
}

body.text-center[style*="overflow-y"] .menuLeftItem > .menuText > .el-badge {
    display: flex;
    flex: 1;
    align-items: center;
    justify-content: space-between;
}

body.text-center[style*="overflow-y"] .menuLeftItem .menuText {
    color: var(--ui-text) !important;
    font-size: 15px !important;
    font-weight: 600 !important;
}

body.text-center[style*="overflow-y"] .menuLeftItem:hover {
    background: #f3f7fb !important;
    border-color: #e5edf3;
}

body.text-center[style*="overflow-y"] .menuLeftItem:hover i {
    color: var(--ui-blue-600) !important;
}

body.text-center[style*="overflow-y"] .menuLeftItem.active {
    position: relative;
    background: var(--ui-blue-100) !important;
    border-color: #d5e4ff;
    box-shadow: inset 4px 0 0 var(--ui-blue-600), 0 4px 12px rgba(62, 120, 232, .08);
}

body.text-center[style*="overflow-y"] .menuLeftItem.active i,
body.text-center[style*="overflow-y"] .menuLeftItem.active .menuText,
body.text-center[style*="overflow-y"] .menuLeftItem.active .menuText > span,
body.text-center[style*="overflow-y"] .menuLeftItem.active .menuText > .el-badge {
    color: var(--ui-blue-600) !important;
}

body.text-center[style*="overflow-y"] .menuLeftItem .el-badge {
    margin-left: auto;
}

body.text-center[style*="overflow-y"] .menuLeftItem .el-badge__content {
    min-width: 22px;
    height: 20px;
    padding: 0 7px;
    border: 0 !important;
    border-radius: var(--ui-radius-pill);
    background: var(--ui-blue-600) !important;
    box-shadow: 0 2px 6px rgba(62, 120, 232, .22);
    color: #ffffff !important;
    font-size: 11px;
    font-weight: 700;
    line-height: 20px;
}

body.text-center[style*="overflow-y"] .mainSubmenu {
    padding: 2px 0 8px;
}

body.text-center[style*="overflow-y"] .mainSubmenuCategory {
    min-height: 34px;
    margin: 4px 10px 2px;
    padding: 0 14px 0 51px;
    border-radius: 8px;
    color: var(--ui-text-muted);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: .04em;
}

body.text-center[style*="overflow-y"] .mainSubmenuCategory:hover,
body.text-center[style*="overflow-y"] .mainSubmenuCategory.expanded {
    background: #f6f9fc;
    color: var(--ui-text-secondary);
}

body.text-center[style*="overflow-y"] .mainSubmenuCategory i {
    color: #9aabbc;
    font-size: 11px;
}

body.text-center[style*="overflow-y"] .mainSubmenuItem {
    width: calc(100% - 20px);
    min-height: 40px;
    margin: 2px 10px;
    padding: 0 14px 0 51px;
    border-radius: 8px;
    color: var(--ui-text-secondary);
    font-size: 13px;
}

body.text-center[style*="overflow-y"] .mainSubmenuItem.nested {
    padding-left: 63px;
}

body.text-center[style*="overflow-y"] .mainSubmenuItem:hover {
    background: #f3f7fb;
    color: var(--ui-text);
}

body.text-center[style*="overflow-y"] .mainSubmenuItem.active {
    background: #eef4ff;
    color: var(--ui-blue-600);
    font-weight: 700;
    box-shadow: inset 3px 0 0 var(--ui-blue-500);
}

body.text-center[style*="overflow-y"] .mainSubmenuDot {
    width: 6px;
    height: 6px;
    background: currentColor;
    opacity: .8;
}

body.text-center[style*="overflow-y"] .mainLeftMenu.collapsed {
    width: 64px !important;
    min-width: 64px !important;
}

body.text-center[style*="overflow-y"] .mainLeftMenu.collapsed .menuLeftItem {
    width: calc(100% - 16px) !important;
    min-height: 44px !important;
    height: 44px !important;
    margin: 4px 8px !important;
    padding: 0 !important;
}

body.text-center[style*="overflow-y"] .mainLeftMenu.collapsed .menuLeftItem.active {
    box-shadow: inset 4px 0 0 var(--ui-blue-600), 0 3px 10px rgba(62, 120, 232, .08);
}

@media (max-width: 900px) {
    body.text-center[style*="overflow-y"] .mainLeftMenu {
        width: 240px !important;
        min-width: 240px !important;
    }

    body.text-center[style*="overflow-y"] .menuLeftItem {
        min-height: 48px !important;
        height: 48px !important;
    }
}
