/* Zeno-inspired application shell. Keeps CEDAR's navigation and permissions while matching
   the reference template's dimensions, rhythm, typography and interaction states. */
:root {
    --cedar-sidebar-width: 240px;
    --cedar-sidebar-mini-width: 80px;
    --cedar-header-height: 68px;
    --cedar-sidebar-bg: #ffffff;
    --cedar-sidebar-text: #61748f;
    --cedar-sidebar-text-hover: #7961f5;
    --cedar-sidebar-active-bg: rgba(121, 97, 245, 0.1);
    --cedar-sidebar-active-border: #7961f5;
    --cedar-header-bg: #ffffff;
    --cedar-content-bg: #f7f6fb;
    /* Slightly deepened from the reference purple so 12.8px menu text remains WCAG AA. */
    --zeno-primary: #654bdc;
    --zeno-border: #e9e8ef;
    --zeno-text: #191919;
    --zeno-muted: #61748f;
}

body.authenticated-layout {
    background: var(--cedar-content-bg);
    color: var(--zeno-text);
    font-family: "Poppins", sans-serif;
    font-size: 13px;
}

.authenticated-layout .cedar-app-wrapper {
    background: var(--cedar-content-bg);
}

/* Sidebar */
.authenticated-layout .cedar-sidebar {
    width: var(--cedar-sidebar-width);
    overflow: hidden;
    background: #fff;
    border-right: 1px solid var(--zeno-border);
    box-shadow: none;
    color: var(--zeno-text);
    transition: width .25s ease, transform .25s ease;
}

.authenticated-layout .cedar-sidebar-header {
    flex: 0 0 var(--cedar-header-height);
    min-height: var(--cedar-header-height);
    height: var(--cedar-header-height);
    padding: 13px 16px;
    border-bottom: 1px solid var(--zeno-border);
    background: #fff;
}

.authenticated-layout .cedar-sidebar-brand {
    gap: .55rem;
    color: #111;
    font-size: 1.55rem;
    font-weight: 600;
    letter-spacing: -.04em;
    white-space: nowrap;
}

.authenticated-layout .cedar-sidebar-brand:hover {
    color: #111;
}

.authenticated-layout .cedar-brand-mark {
    width: 2.25rem;
    height: 2.25rem;
    flex-basis: 2.25rem;
    filter: none;
}

.authenticated-layout .cedar-sidebar-nav {
    padding: 8px 0 28px;
    overflow-x: hidden;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: #d8d6e2 transparent;
}

.authenticated-layout .cedar-sidebar-nav::-webkit-scrollbar {
    width: 4px;
}

.authenticated-layout .cedar-sidebar-nav::-webkit-scrollbar-thumb {
    background: #d8d6e2;
    border-radius: 10px;
}

.authenticated-layout .cedar-nav-category {
    padding: 12px 28px 8px;
    color: var(--zeno-muted);
    font-size: 10.4px;
    font-weight: 500;
    letter-spacing: .06em;
    line-height: 1.5;
    list-style: none;
    text-transform: uppercase;
}

.authenticated-layout .cedar-nav-item,
.authenticated-layout .cedar-nav-section {
    margin: 2px 8px;
}

.authenticated-layout .cedar-nav-link,
.authenticated-layout .cedar-nav-header {
    min-height: 42.8px;
    border: 1px solid transparent;
    border-radius: 4px;
    color: var(--zeno-muted);
    font-size: 12.8px;
    font-weight: 400;
    line-height: 1.5;
    letter-spacing: 0;
    text-transform: none;
    transition: color .15s ease, background-color .15s ease;
}

.authenticated-layout .cedar-nav-link {
    gap: 12px;
    padding: 10.4px 20px;
    border-left: 1px solid transparent;
}

.authenticated-layout .cedar-nav-header {
    justify-content: flex-start;
    gap: 12px;
    width: 100%;
    margin: 0;
    padding: 10.4px 20px;
}

.authenticated-layout .cedar-nav-link > i,
.authenticated-layout .cedar-nav-header > i:first-child {
    width: 20px;
    flex: 0 0 20px;
    color: #61748f;
    font-size: 17px;
    line-height: 1;
    text-align: center;
}

.authenticated-layout .cedar-nav-header > span {
    min-width: 0;
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.authenticated-layout .cedar-nav-header .cedar-nav-toggle {
    margin-left: auto;
    color: #98a3b3;
    font-size: 10px;
}

.authenticated-layout .cedar-nav-link:hover,
.authenticated-layout .cedar-nav-header:hover {
    background: rgba(121, 97, 245, .055);
    color: var(--zeno-primary);
}

.authenticated-layout .cedar-nav-link:hover > i,
.authenticated-layout .cedar-nav-header:hover > i:first-child {
    color: var(--zeno-primary);
}

.authenticated-layout .cedar-nav-link.active,
.authenticated-layout .cedar-nav-section.has-active > .cedar-nav-header {
    border-color: transparent;
    background: var(--cedar-sidebar-active-bg);
    color: var(--zeno-primary);
    font-weight: 500;
}

.authenticated-layout .cedar-nav-link.active > i,
.authenticated-layout .cedar-nav-section.has-active > .cedar-nav-header > i:first-child {
    color: var(--zeno-primary);
}

.authenticated-layout .cedar-nav-section-items {
    padding: 4px 0 6px;
}

.authenticated-layout .cedar-nav-section-items .cedar-nav-item {
    margin: 0;
}

.authenticated-layout .cedar-nav-section-items .cedar-nav-link {
    position: relative;
    min-height: 36px;
    padding: 7px 20px 7px 48px;
    border-radius: 0;
    background: transparent;
    font-size: 12.2px;
}

.authenticated-layout .cedar-nav-section-items .cedar-nav-link > i {
    display: none;
}

.authenticated-layout .cedar-nav-section-items .cedar-nav-link::before {
    position: absolute;
    left: 34px;
    width: 5px;
    height: 5px;
    border: 1px solid currentColor;
    border-radius: 50%;
    content: "";
}

.authenticated-layout .cedar-nav-section-items .cedar-nav-link:hover,
.authenticated-layout .cedar-nav-section-items .cedar-nav-link.active {
    background: transparent;
    color: var(--zeno-primary);
}

.authenticated-layout .menu-search-hidden {
    display: none !important;
}

/* Header and page frame */
.authenticated-layout .cedar-main-wrapper {
    min-width: 0;
    margin-left: var(--cedar-sidebar-width);
    background: var(--cedar-content-bg);
    transition: margin-left .25s ease;
}

.authenticated-layout .cedar-top-header {
    height: var(--cedar-header-height);
    border-bottom: 1px solid var(--zeno-border);
    background: #fff;
    box-shadow: 0 0 8px rgba(0, 0, 0, .024);
}

.authenticated-layout .cedar-header-content {
    justify-content: flex-start;
    gap: 12px;
    padding: 0 24px;
}

.authenticated-layout .cedar-sidebar-toggle {
    display: inline-grid;
    width: 36px;
    height: 36px;
    flex: 0 0 36px;
    place-items: center;
    padding: 0;
    color: #4d5b70;
    font-size: 22px;
}

.authenticated-layout .cedar-sidebar-toggle:hover,
.authenticated-layout .cedar-header-icon:hover {
    background: #f4f2ff;
    color: var(--zeno-primary);
}

.authenticated-layout #sidebarClose {
    display: none;
}

.authenticated-layout .cedar-menu-search {
    width: 322px;
    height: 38px;
    align-items: center;
    gap: 10px;
    margin-left: 4px;
    padding: 0 14px;
    border: 1px solid var(--zeno-border);
    border-radius: 20px;
    color: #7a8799;
}

.authenticated-layout .cedar-menu-search input {
    width: 100%;
    border: 0;
    outline: 0;
    background: transparent;
    color: var(--zeno-text);
    font-family: inherit;
    font-size: 12px;
}

.authenticated-layout .cedar-menu-search input::placeholder {
    color: #a2a7b1;
}

.authenticated-layout .cedar-header-actions {
    gap: 8px;
    margin-left: auto;
}

.authenticated-layout .cedar-header-icon {
    display: inline-grid;
    width: 36px;
    height: 36px;
    place-items: center;
    border-radius: 50%;
    color: #4d5b70;
    font-size: 17px;
    text-decoration: none;
}

.authenticated-layout .cedar-theme-toggle,
.authenticated-layout .cedar-fullscreen-toggle {
    border: 0;
    background: transparent;
}

html.cedar-fullscreen-fallback,
html.cedar-fullscreen-fallback body {
    width: 100%;
    height: 100%;
    overflow: hidden;
}

html.cedar-fullscreen-fallback body.authenticated-layout {
    position: fixed;
    inset: 0;
    z-index: 2147483647;
    width: 100vw;
    height: 100vh;
    overflow: auto;
}

.authenticated-layout .cedar-context-selector {
    gap: 8px !important;
}

.authenticated-layout .cedar-context-selector .form-select {
    height: 36px;
    min-width: 170px;
    padding: 5px 32px 5px 12px;
    border-color: var(--zeno-border);
    border-radius: 4px;
    background-color: #fff;
    color: #4d5b70;
    font-family: inherit;
    font-size: 11.5px;
    box-shadow: none;
}

.authenticated-layout .cedar-header-actions .navbar-nav {
    gap: 0 !important;
}

.authenticated-layout .cedar-user-trigger {
    min-width: 38px;
    padding: 0 !important;
}

.authenticated-layout .cedar-user-trigger::after,
.authenticated-layout .cedar-user-name {
    display: none;
}

.authenticated-layout .cedar-user-avatar {
    display: inline-grid;
    width: 34px;
    height: 34px;
    place-items: center;
    border: 2px solid #ece8ff;
    border-radius: 50%;
    background: linear-gradient(135deg, #9b8af8, #6246df);
    color: #fff;
    font-size: 16px;
}

.authenticated-layout .dropdown-menu {
    border-color: var(--zeno-border);
    border-radius: 6px;
    font-size: 12.5px;
    box-shadow: 0 8px 24px rgba(35, 31, 64, .1);
}

.authenticated-layout .cedar-content {
    padding: 24px;
}

.authenticated-layout .cedar-footer {
    border-color: var(--zeno-border);
    padding: 14px 24px;
    background: #fff;
}

.authenticated-layout .cedar-footer-content {
    color: var(--zeno-muted);
    font-size: 12px;
}

/* Desktop mini sidebar, matching Zeno's compact navigation mode. */
@media (min-width: 992px) {
    body.sidebar-collapsed .cedar-sidebar {
        width: var(--cedar-sidebar-mini-width);
    }

    body.sidebar-collapsed .cedar-main-wrapper {
        margin-left: var(--cedar-sidebar-mini-width);
    }

    body.sidebar-collapsed .cedar-sidebar-header {
        justify-content: center;
        padding-inline: 12px;
    }

    body.sidebar-collapsed .cedar-sidebar-brand span,
    body.sidebar-collapsed .cedar-nav-category,
    body.sidebar-collapsed .cedar-nav-header .cedar-nav-toggle,
    body.sidebar-collapsed .cedar-nav-section-items {
        display: none !important;
    }

    body.sidebar-collapsed .cedar-nav-link span,
    body.sidebar-collapsed .cedar-nav-header span {
        position: absolute !important;
        width: 1px !important;
        height: 1px !important;
        overflow: hidden !important;
        clip: rect(0, 0, 0, 0) !important;
        clip-path: inset(50%) !important;
        white-space: nowrap !important;
    }

    body.sidebar-collapsed .cedar-nav-item,
    body.sidebar-collapsed .cedar-nav-section {
        margin: 4px 8px;
    }

    body.sidebar-collapsed .cedar-nav-link,
    body.sidebar-collapsed .cedar-nav-header {
        justify-content: center;
        gap: 0;
        padding: 10px;
    }
}

@media (max-width: 1199.98px) and (min-width: 992px) {
    .authenticated-layout .cedar-menu-search {
        display: none !important;
    }

    .authenticated-layout .cedar-context-selector .form-select {
        min-width: 145px;
        max-width: 185px;
    }
}

/* Mobile header and off-canvas menu. */
@media (max-width: 991.98px) {
    .authenticated-layout .cedar-sidebar {
        z-index: 1060;
        transform: translateX(-100%);
    }

    .authenticated-layout .cedar-sidebar.show {
        transform: translateX(0);
    }

    .authenticated-layout .cedar-main-wrapper {
        margin-left: 0;
    }

    .authenticated-layout .cedar-header-content {
        gap: 4px;
        padding: 0 16px;
    }

    .authenticated-layout .cedar-mobile-brand {
        width: 34px;
        height: 34px;
        margin-right: 2px;
    }

    .authenticated-layout .cedar-mobile-brand img {
        width: 100%;
        height: 100%;
    }

    .authenticated-layout #sidebarClose {
        display: inline-grid;
        width: 32px;
        height: 32px;
        place-items: center;
        color: #61748f;
    }

    .authenticated-layout .cedar-context-selector {
        display: none !important;
    }

    .authenticated-layout .cedar-content {
        padding: 24px;
    }

    .authenticated-layout .cedar-footer {
        padding-inline: 20px;
    }

    .authenticated-layout .cedar-sidebar-overlay {
        z-index: 1055;
        background: rgba(25, 25, 25, .45);
    }
}

@media (max-width: 575.98px) {
    .authenticated-layout .cedar-content {
        padding: 20px 16px;
    }

    .authenticated-layout .cedar-header-content {
        padding-inline: 12px;
    }

    .authenticated-layout .cedar-footer-content {
        gap: 8px;
    }
}

/* Dark mode */
html[data-theme="dark"] {
    color-scheme: dark;
    --cedar-bg-light: #141432;
    --cedar-bg-card: #1d1d42;
    --cedar-gray-100: #242449;
    --cedar-gray-200: #2c2c50;
    --cedar-gray-300: #39395a;
    --cedar-gray-400: #575774;
    --cedar-gray-600: rgba(255, 255, 255, .6);
    --cedar-gray-700: rgba(255, 255, 255, .72);
    --cedar-gray-800: rgba(255, 255, 255, .85);
    --cedar-gray-900: #fff;
    --cedar-text-primary: rgba(255, 255, 255, .8);
    --cedar-text-secondary: rgba(255, 255, 255, .6);
    --cedar-text-muted: rgba(255, 255, 255, .5);
    --cedar-shadow-card: 0 2px 1px -1px rgba(255, 255, 255, .05);
    --cedar-shadow: 0 .5rem 1rem rgba(0, 0, 0, .18);
}

html[data-theme="dark"] body.authenticated-layout {
    --cedar-sidebar-bg: #1d1d42;
    --cedar-sidebar-text: rgba(255, 255, 255, .6);
    --cedar-header-bg: #1d1d42;
    --cedar-content-bg: #141432;
    --zeno-border: rgba(255, 255, 255, .1);
    --zeno-text: rgba(255, 255, 255, .8);
    --zeno-muted: rgba(255, 255, 255, .6);
    --bs-body-bg: #141432;
    --bs-body-color: rgba(255, 255, 255, .8);
    background: #141432;
    color: rgba(255, 255, 255, .8);
}

html[data-theme="dark"] .authenticated-layout .cedar-app-wrapper,
html[data-theme="dark"] .authenticated-layout .cedar-main-wrapper,
html[data-theme="dark"] .authenticated-layout .cedar-content {
    background: #141432;
}

html[data-theme="dark"] .authenticated-layout .cedar-sidebar,
html[data-theme="dark"] .authenticated-layout .cedar-sidebar-header,
html[data-theme="dark"] .authenticated-layout .cedar-top-header,
html[data-theme="dark"] .authenticated-layout .cedar-footer {
    border-color: rgba(255, 255, 255, .1);
    background: #1d1d42;
    color: rgba(255, 255, 255, .8);
}

html[data-theme="dark"] .authenticated-layout .cedar-sidebar-brand,
html[data-theme="dark"] .authenticated-layout .cedar-sidebar-brand:hover {
    color: #fff;
}

html[data-theme="dark"] .authenticated-layout .cedar-nav-category,
html[data-theme="dark"] .authenticated-layout .cedar-nav-link,
html[data-theme="dark"] .authenticated-layout .cedar-nav-header,
html[data-theme="dark"] .authenticated-layout .cedar-nav-link > i,
html[data-theme="dark"] .authenticated-layout .cedar-nav-header > i:first-child,
html[data-theme="dark"] .authenticated-layout .cedar-sidebar-toggle,
html[data-theme="dark"] .authenticated-layout .cedar-header-icon {
    color: rgba(255, 255, 255, .6);
}

html[data-theme="dark"] .authenticated-layout .cedar-nav-link:hover,
html[data-theme="dark"] .authenticated-layout .cedar-nav-header:hover,
html[data-theme="dark"] .authenticated-layout .cedar-nav-link.active,
html[data-theme="dark"] .authenticated-layout .cedar-nav-section.has-active > .cedar-nav-header {
    background: rgba(121, 97, 245, .1);
    color: #fff;
}

html[data-theme="dark"] .authenticated-layout .cedar-nav-link:hover > i,
html[data-theme="dark"] .authenticated-layout .cedar-nav-header:hover > i:first-child,
html[data-theme="dark"] .authenticated-layout .cedar-nav-link.active > i,
html[data-theme="dark"] .authenticated-layout .cedar-nav-section.has-active > .cedar-nav-header > i:first-child {
    color: #fff;
}

html[data-theme="dark"] .authenticated-layout .cedar-menu-search,
html[data-theme="dark"] .authenticated-layout .cedar-context-selector .form-select {
    border-color: rgba(255, 255, 255, .1);
    background-color: #1d1d42;
    color: #fff;
}

html[data-theme="dark"] .authenticated-layout .cedar-menu-search input {
    color: #fff;
}

html[data-theme="dark"] .authenticated-layout .cedar-menu-search input::placeholder {
    color: rgba(255, 255, 255, .5);
}

html[data-theme="dark"] .authenticated-layout .cedar-sidebar-toggle:hover,
html[data-theme="dark"] .authenticated-layout .cedar-header-icon:hover {
    background: rgba(121, 97, 245, .1);
    color: #fff;
}

html[data-theme="dark"] .authenticated-layout .card,
html[data-theme="dark"] .authenticated-layout .cedar-card,
html[data-theme="dark"] .authenticated-layout .cedar-widget,
html[data-theme="dark"] .authenticated-layout .cedar-stat-card,
html[data-theme="dark"] .authenticated-layout .list-group-item,
html[data-theme="dark"] .authenticated-layout .accordion-item,
html[data-theme="dark"] .authenticated-layout .modal-content,
html[data-theme="dark"] .authenticated-layout .dropdown-menu,
html[data-theme="dark"] .authenticated-layout .user-guide-section,
html[data-theme="dark"] .authenticated-layout .user-guide-toc,
html[data-theme="dark"] .authenticated-layout .user-guide-workflows article {
    border-color: rgba(255, 255, 255, .1);
    background: #1d1d42;
    color: rgba(255, 255, 255, .8);
}

html[data-theme="dark"] .authenticated-layout .card-header,
html[data-theme="dark"] .authenticated-layout .cedar-card-header,
html[data-theme="dark"] .authenticated-layout .cedar-widget-header,
html[data-theme="dark"] .authenticated-layout .accordion-button,
html[data-theme="dark"] .authenticated-layout .modal-header,
html[data-theme="dark"] .authenticated-layout .modal-footer {
    border-color: rgba(255, 255, 255, .1);
    background: #1d1d42;
    color: rgba(255, 255, 255, .8);
}

html[data-theme="dark"] .authenticated-layout .table {
    --bs-table-bg: transparent;
    --bs-table-color: rgba(255, 255, 255, .8);
    --bs-table-border-color: rgba(255, 255, 255, .1);
    --bs-table-striped-bg: rgba(255, 255, 255, .025);
    --bs-table-striped-color: rgba(255, 255, 255, .8);
    --bs-table-hover-bg: rgba(121, 97, 245, .08);
    --bs-table-hover-color: #fff;
}

html[data-theme="dark"] .authenticated-layout .table thead,
html[data-theme="dark"] .authenticated-layout .table-light {
    --bs-table-bg: rgba(255, 255, 255, .04);
    --bs-table-color: #fff;
}

html[data-theme="dark"] .authenticated-layout .form-control,
html[data-theme="dark"] .authenticated-layout .form-select,
html[data-theme="dark"] .authenticated-layout .input-group-text {
    border-color: rgba(255, 255, 255, .1);
    background-color: #1d1d42;
    color: #fff;
}

html[data-theme="dark"] .authenticated-layout .form-control::placeholder {
    color: rgba(255, 255, 255, .5);
}

html[data-theme="dark"] .authenticated-layout .dropdown-item {
    color: rgba(255, 255, 255, .8);
}

html[data-theme="dark"] .authenticated-layout .dropdown-item:hover,
html[data-theme="dark"] .authenticated-layout .dropdown-item:focus {
    background: rgba(121, 97, 245, .1);
    color: #fff;
}

html[data-theme="dark"] .authenticated-layout a:not(.btn):not(.cedar-nav-link):not(.cedar-sidebar-brand):not(.cedar-header-icon):not(.dropdown-item) {
    color: #75adff;
}

html[data-theme="dark"] .authenticated-layout .btn-outline-primary {
    border-color: #75adff;
    color: #75adff;
}

html[data-theme="dark"] .authenticated-layout .btn-outline-primary:hover,
html[data-theme="dark"] .authenticated-layout .btn-outline-primary:focus-visible,
html[data-theme="dark"] .authenticated-layout .btn-outline-primary:active {
    border-color: #75adff;
    background: #75adff;
    color: #08111f;
}

html[data-theme="dark"] .authenticated-layout .btn-outline-secondary {
    border-color: rgba(255, 255, 255, .45);
    color: rgba(255, 255, 255, .8);
}

html[data-theme="dark"] .authenticated-layout .btn-outline-secondary:hover,
html[data-theme="dark"] .authenticated-layout .btn-outline-secondary:focus-visible,
html[data-theme="dark"] .authenticated-layout .btn-outline-secondary:active {
    border-color: rgba(255, 255, 255, .8);
    background: rgba(255, 255, 255, .12);
    color: #fff;
}

html[data-theme="dark"] .authenticated-layout code {
    color: #ff83bd;
}

html[data-theme="dark"] .authenticated-layout .text-muted {
    color: rgba(255, 255, 255, .6) !important;
}

html[data-theme="dark"] .authenticated-layout h1,
html[data-theme="dark"] .authenticated-layout h2,
html[data-theme="dark"] .authenticated-layout h3,
html[data-theme="dark"] .authenticated-layout h4,
html[data-theme="dark"] .authenticated-layout h5,
html[data-theme="dark"] .authenticated-layout h6,
html[data-theme="dark"] .authenticated-layout .cedar-widget-title,
html[data-theme="dark"] .authenticated-layout .stat-value,
html[data-theme="dark"] .authenticated-layout .user-guide-section-heading h2,
html[data-theme="dark"] .authenticated-layout .user-guide-workflows h3 {
    color: #fff;
}

html[data-theme="dark"] .authenticated-layout .cedar-quick-action,
html[data-theme="dark"] .authenticated-layout .user-guide-sequence,
html[data-theme="dark"] .authenticated-layout .user-guide-sequence span {
    border-color: rgba(255, 255, 255, .1);
    background: #181838;
    color: rgba(255, 255, 255, .8);
}

html[data-theme="dark"] .authenticated-layout .alert-info {
    border-color: rgba(117, 173, 255, .35);
    background: rgba(117, 173, 255, .1);
    color: #d8f3ff;
}

html[data-theme="dark"] .authenticated-layout .user-guide-callout {
    background: rgba(38, 191, 148, .12);
    color: #d8eeee;
}

html[data-theme="dark"] .authenticated-layout .user-guide-help {
    background: linear-gradient(135deg, #1d1d42 0%, #24244d 100%);
}
