/* ===========================================
   Z-Index Hierarchy (matches CortexConnectPortal)
   =========================================== */
:root {
    --z-notification: 30001;
    --z-loading-screen: 9999;
    --z-modal: 1050;
    --z-dropdown: 1060;
    --z-drawer-mobile: 900;
    --z-sticky: 50;
}

html, body {
    font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
    color: var(--bs-light-text-emphasis);
}

html, body, #app, .page {
    height: 100%;
    margin: 0;
}


/* Smooth scrolling for main page navigation (anchors, programmatic scrolling)
   Note: Avoid applying to all elements (*) as it interferes with
   DxGrid scrollbar drag functionality */
html {
    scroll-behavior: smooth;
}

/* Ensure all scrollable areas support touch scrolling */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bs-secondary-bg);
}

::-webkit-scrollbar-thumb {
    background: var(--bs-secondary);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--bs-secondary-dark);
}

/* Ensure main container establishes height context */
#main-container {
    height: 100%;
    display: flex;
    flex-direction: column;
}

/* Bootstrap container must not break height chain */
#main-container.container {
    max-width: 100%;
    padding-left: 1rem;
    padding-right: 1rem;
    height: 100%;
}

/* Row must properly size within container */
#main-container .row {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    margin: 0;
}

/* Tabs container gets constrained height from row */
#main-container .tabs-container {
    flex: 1;
    min-height: 0; /* Critical for flex scrolling */
}

.page {
    display: flex;
    flex-direction: column;
}

main {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden; /* prevent page-level scroll */
}

article.content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.content {
    padding-top: 1rem;
}

h1:focus {
    outline: none;
}

a, .btn-link {
    color: #0071c1;
}

/* Material Icons alignment - font-size comes from Theming/css/material-symbols/index.css (24px) */
.material-symbols-outlined {
    vertical-align: middle;
}

/* Smaller icons in grid cells for compact display - !important needed to override Theming base class */
.dxbl-grid .material-symbols-outlined {
    font-size: 18px !important;
}

/* ===========================================
   Dashboard & Tab Height Containment
   Pattern: Every flex level needs min-height: 0
   =========================================== */

/* Dashboard container - establishes flex context */
.dashboard-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
}

/* Tabs wrapper - constrains DxTabs height */
.dashboard-tabs-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
}

/* DxTabs component itself must flex and shrink */
.dashboard-tabs-wrapper .dxbl-tabs {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    height: 100%;
}

/* Tab content panel - container for all tab pages */
.dashboard-tabs-wrapper .dxbl-tabs-content-panel {
    flex: 1;
    min-height: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

/* Individual tab content - grid handles its own scrolling */
.dashboard-tabs-wrapper .dxbl-tabs-content {
    flex: 1;
    min-height: 0;
    overflow: hidden;
    -webkit-overflow-scrolling: touch;
}

/* Nested tabs within tab content */
.dashboard-tabs-wrapper .nested-tabs {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    height: 100%;
}

.dashboard-tabs-wrapper .nested-tabs .dxbl-tabs {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    height: 100%;
}

.dashboard-tabs-wrapper .nested-tabs .dxbl-tabs-content-panel {
    flex: 1;
    min-height: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.dashboard-tabs-wrapper .nested-tabs .dxbl-tabs-content {
    flex: 1;
    min-height: 0;
    overflow: hidden;
    -webkit-overflow-scrolling: touch;
    /* padding removed - list-container handles padding */
}

/* Tab content wrapper for non-nested tabs */
.tab-content-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: auto;
    -webkit-overflow-scrolling: touch;
    padding: 1rem;
}

/* Legacy tabs-container support (for backward compatibility) */
.tabs-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
}

.btn-primary {
    color: #fff;
    background-color: #1b6ec2;
    border-color: #1861ac;
}

/* Highlight 'Apply' button when active */
@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(var(--bs-primary-rgb), .7);
    }

    70% {
        box-shadow: 0 0 0 0.75rem rgba(var(--bs-primary-rgb), 0);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(var(--bs-primary-rgb), 0);
    }
}

/* Apply class is added dynamically via GetApplyButtonCss() */
.apply-highlight {
    animation: pulse 1.6s cubic-bezier(0.66, 0, 0, 1) infinite;
    transition: transform 0.15s ease-in-out;
}

    .apply-highlight:hover {
        transform: scale(1.03);
    }

/* Respect user preference for reduced motion */
@media (prefers-reduced-motion: reduce) {
    .apply-highlight {
        animation: none;
    }
}


.dxbl-image {
    vertical-align: middle;
}

.dxbl-treeview-item-text {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 12px;
    max-width: 200px;
    display: inline-block;
    vertical-align: middle;
}

.dxbl-menu-item-text-container {
    color: white;
}

.btn:focus, .btn:active:focus, .btn-link.nav-link:focus, .form-control:focus, .form-check-input:focus {
    box-shadow: 0 0 0 0.1rem white, 0 0 0 0.25rem #258cfb;
}

/* Form controls should use theme text color */
.form-control,
.form-select,
input.form-control,
textarea.form-control,
select.form-control {
    color: var(--bs-light-text-emphasis);
}

.valid.modified:not([type=checkbox]) {
    outline: 1px solid #26b050;
}

.invalid {
    outline: 1px solid red;
}

.validation-message {
    color: red;
}

#blazor-error-ui {
    background: lightyellow;
    bottom: 0;
    box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2);
    display: none;
    left: 0;
    padding: 0.6rem 1.25rem 0.7rem 1.25rem;
    position: fixed;
    width: 100%;
    z-index: var(--z-notification);
}

    #blazor-error-ui .dismiss {
        cursor: pointer;
        position: absolute;
        right: 0.75rem;
        top: 0.5rem;
    }

.blazor-error-boundary {
    background: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTYiIGhlaWdodD0iNDkiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIG92ZXJmbG93PSJoaWRkZW4iPjxkZWZzPjxjbGlwUGF0aCBpZD0iY2xpcDAiPjxyZWN0IHg9IjIzNSIgeT0iNTEiIHdpZHRoPSI1NiIgaGVpZ2h0PSI0OSIvPjwvY2xpcFBhdGg+PC9kZWZzPjxnIGNsaXAtcGF0aD0idXJsKCNjbGlwMCkiIHRyYW5zZm9ybT0idHJhbnNsYXRlKC0yMzUgLTUxKSI+PHBhdGggZD0iTTI2My41MDYgNTFDMjY0LjcxNyA1MSAyNjUuODEzIDUxLjQ4MzcgMjY2LjYwNiA1Mi4yNjU4TDI2Ny4wNTIgNTIuNzk4NyAyNjcuNTM5IDUzLjYyODMgMjkwLjE4NSA5Mi4xODMxIDI5MC41NDUgOTIuNzk1IDI5MC42NTYgOTIuOTk2QzI5MC44NzcgOTMuNTEzIDI5MSA5NC4wODE1IDI5MSA5NC42NzgyIDI5MSA5Ny4wNjUxIDI4OS4wMzggOTkgMjg2LjYxNyA5OUwyNDAuMzgzIDk5QzIzNy45NjMgOTkgMjM2IDk3LjA2NTEgMjM2IDk0LjY3ODIgMjM2IDk0LjM3OTkgMjM2LjAzMSA5NC4wODg2IDIzNi4wODkgOTMuODA3MkwyMzYuMzM4IDkzLjAxNjIgMjM2Ljg1OCA5Mi4xMzE0IDI1OS40NzMgNTMuNjI5NCAyNTkuOTYxIDUyLjc5ODUgMjYwLjQwNyA1Mi4yNjU4QzI2MS4yIDUxLjQ4MzcgMjYyLjI5NiA1MSAyNjMuNTA2IDUxWk0yNjMuNTg2IDY2LjAxODNDMjYwLjczNyA2Ni4wMTgzIDI1OS4zMTMgNjcuMTI0NSAyNTkuMzEzIDY5LjMzNyAyNTkuMzEzIDY5LjYxMDIgMjU5LjMzMiA2OS44NjA4IDI1OS4zNzEgNzAuMDg4N0wyNjEuNzk1IDg0LjAxNjEgMjY1LjM4IDg0LjAxNjEgMjY3LjgyMSA2OS43NDc1QzI2Ny44NiA2OS43MzA5IDI2Ny44NzkgNjkuNTg3NyAyNjcuODc5IDY5LjMxNzkgMjY3Ljg3OSA2Ny4xMTgyIDI2Ni40NDggNjYuMDE4MyAyNjMuNTg2IDY2LjAxODNaTTI2My41NzYgODYuMDU0N0MyNjEuMDQ5IDg2LjA1NDcgMjU5Ljc4NiA4Ny4zMDA1IDI1OS43ODYgODkuNzkyMSAyNTkuNzg2IDkyLjI4MzcgMjYxLjA0OSA5My41Mjk1IDI2My41NzYgOTMuNTI5NSAyNjYuMTE2IDkzLjUyOTUgMjY3LjM4NyA5Mi4yODM3IDI2Ny4zODcgODkuNzkyMSAyNjcuMzg3IDg3LjMwMDUgMjY2LjExNiA4Ni4wNTQ3IDI2My41NzYgODYuMDU0N1oiIGZpbGw9IiNGRkU1MDAiIGZpbGwtcnVsZT0iZXZlbm9kZCIvPjwvZz48L3N2Zz4=) no-repeat 1rem/1.8rem, #b32121;
    padding: 1rem 1rem 1rem 3.7rem;
    color: white;
}

    .blazor-error-boundary::after {
        content: "An error has occurred."
    }

.loading-progress {
    position: relative;
    display: block;
    width: 8rem;
    height: 8rem;
    margin: 20vh auto 1rem auto;
}

    .loading-progress circle {
        fill: none;
        stroke: #e0e0e0;
        stroke-width: 0.6rem;
        transform-origin: 50% 50%;
        transform: rotate(-90deg);
    }

        .loading-progress circle:last-child {
            stroke: #1b6ec2;
            stroke-dasharray: calc(3.141 * var(--blazor-load-percentage, 0%) * 0.8), 500%;
            transition: stroke-dasharray 0.05s ease-in-out;
        }

.loading-progress-text {
    position: absolute;
    text-align: center;
    font-weight: bold;
    inset: calc(20vh + 3.25rem) 0 auto 0.2rem;
}

    .loading-progress-text:after {
        content: var(--blazor-load-percentage-text, "Loading");
    }

code {
    color: #c02d76;
}

.filled-icon {
    font-variation-settings: 'FILL' 1, 'wght' 400, 'GRAD' 0, 'opsz' 24
}

#loading-screen {
    position: fixed;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background-color: var(--bs-body-bg);
    z-index: var(--z-loading-screen);
}

    #loading-screen .loading-logo {
        width: 160px;
        margin-bottom: 1.5rem;
    }

    #loading-screen .bar-container {
        width: 60%;
        max-width: 360px;
        height: 6px;
        background: rgba(0,0,0,0.1);
        border-radius: 3px;
        overflow: hidden;
    }

    /* paddle is 50% wide, slides full-width of itself (i.e. half the container) */
    #loading-screen .bar {
        width: 50%;
        height: 100%;
        background: var(--bs-primary);
        /* start at left edge */
        transform: translateX(0);
        /* slide to 100% of its own width, then back, forever */
        animation: slide 0.6s ease-in-out infinite alternate;
    }

@keyframes slide {
    to {
        transform: translateX(100%);
    }
}

/* Filter Components */
.filter-container {
    padding: 1rem;
}

.filter-container h5 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: var(--bs-heading-color, var(--bs-body-color));
}

.filter-group {
    margin-bottom: 1rem;
}

.filter-group label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    margin-bottom: 0.5rem;
    color: var(--bs-light-text-emphasis);
}

.filter-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 1.5rem;
}

.filter-actions button {
    flex: 1;
}

/* List Components - must be flex children that scroll */
.list-container {
    display: flex;
    flex-direction: column;
    flex: 1;
    height: 100%;
    min-height: 0;
    overflow: hidden;
    padding: 1.5rem;
    -webkit-overflow-scrolling: touch;
}

/* DxGrid with constrained height for internal scrolling */
.scrollable-grid {
    flex: 1;
    min-height: 200px;
    height: 100%;
    overflow: hidden;
}

.list-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.list-header h4 {
    font-size: 1.25rem;
    font-weight: 600;
    margin: 0;
    color: var(--bs-heading-color, var(--bs-body-color));
}

.loading-indicator,
.error-message {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem;
    text-align: center;
}

.error-message {
    color: var(--bs-danger);
}

.error-message p {
    margin-bottom: 1rem;
}

.pagination-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--bs-border-color);
}

.pagination-controls {
    display: flex;
    gap: 0.5rem;
}

/* Status indicators */
.status-online,
.status-active {
    color: var(--bs-success);
    font-weight: 500;
}

.status-offline,
.status-inactive {
    color: var(--bs-secondary);
    font-weight: 500;
}

.deleted-row {
    opacity: 0.6;
    background-color: var(--bs-secondary-bg);
}

/* Detail Components */
.detail-container {
    padding: 1.5rem;
}

.detail-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid var(--bs-border-color);
}

.detail-header h4 {
    font-size: 1.5rem;
    font-weight: 600;
    margin: 0;
    color: var(--bs-heading-color, var(--bs-body-color));
}

.detail-actions {
    display: flex;
    gap: 0.5rem;
}

.detail-content {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.form-section {
    background: var(--bs-body-bg);
    padding: 1.5rem;
    border-radius: 0.5rem;
    border: 1px solid var(--bs-border-color);
}

.form-section h5 {
    font-size: 1.125rem;
    font-weight: 600;
    margin-bottom: 1.5rem;
    color: var(--bs-heading-color, var(--bs-body-color));
    border-bottom: 1px solid var(--bs-border-color);
    padding-bottom: 0.5rem;
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group:last-child {
    margin-bottom: 0;
}

.form-group label {
    display: block;
    font-size: 0.875rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--bs-light-text-emphasis);
}

.form-group p {
    margin: 0;
    padding: 0.5rem 0;
    font-size: 0.95rem;
    color: var(--bs-light-text-emphasis);
}

/* Responsive adjustments */
@media (max-width: 991px) {
    .list-container,
    .detail-container {
        padding: 1rem;
    }

    .list-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }

    .pagination-info {
        flex-direction: column;
        gap: 1rem;
    }

    .detail-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }
}

/* Mobile-first responsive utilities */
@media (max-width: 767px) {
    /* Reduce padding on small screens */
    .content {
        padding-top: 0.5rem;
        padding-left: 0.5rem !important;
        padding-right: 0.5rem !important;
    }

    .list-container,
    .detail-container,
    .filter-container {
        padding: 0.5rem;
    }

    /* Stack form actions vertically */
    .filter-actions {
        flex-direction: column;
    }

    .filter-actions button {
        width: 100%;
    }

    /* Full-width sections on mobile */
    .form-section {
        padding: 1rem;
    }

    /* Smaller text on mobile */
    .list-header h4 {
        font-size: 1.125rem;
    }

    .detail-header h4 {
        font-size: 1.25rem;
    }

    .form-section h5 {
        font-size: 1rem;
    }

}

/* Tablet adjustments */
@media (min-width: 768px) and (max-width: 991px) {
    .content {
        padding-left: 1rem !important;
        padding-right: 1rem !important;
    }

    .list-container,
    .detail-container {
        padding: 1.25rem;
    }
}

/* DevExpress Grid - Single line rows with text truncation */
.dxbl-grid-data-cell,
.dxbl-grid-header-cell {
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
}

/* Grid cell content should not wrap - ALL elements */
.dxbl-grid-data-cell *,
.dxbl-grid-header-cell *,
.dxbl-grid-data-cell > *,
.dxbl-grid-header-cell > *,
.dxbl-grid-data-cell div,
.dxbl-grid-data-cell span {
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    max-width: 100% !important;
}

/* Badges in grid should also truncate */
.dxbl-grid-data-cell .badge {
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    max-width: 100% !important;
}

/* Disable hover effect on DxGrid empty filler rows */
.dxbl-grid .dxbl-grid-table > tbody > .dxbl-grid-empty-row:hover,
.dxbl-grid .dxbl-grid-table > tbody > .dxbl-grid-empty-row:hover > td {
    background-color: var(--dxbl-grid-row-bg) !important;
    cursor: default !important;
}

/* Target table cells directly in DxGrid */
.dxbl-grid td,
.dxbl-grid th {
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
}

/* Target table cells content */
.dxbl-grid td *,
.dxbl-grid th * {
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
}

/* Action button containers should not force wrapping */
.dxbl-grid-data-cell .action-buttons,
.dxbl-grid-data-cell .action-buttons-mobile {
    white-space: nowrap !important;
    display: inline-flex !important;
    align-items: center !important;
}

/* Specific handling for relations-grid and selector-grid */
.relations-grid td,
.selector-grid td {
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
}

/* DevExpress Grid responsive adjustments */
@media (max-width: 767px) {
    /* Make grids scrollable horizontally on mobile */
    .dxbl-grid {
        overflow-x: auto;
    }

    /* Adjust grid font size */
    .dxbl-grid-table {
        font-size: 0.875rem;
    }

    /* Reduce cell padding */
    .dxbl-grid-data-cell,
    .dxbl-grid-header-cell {
        padding: 0.5rem !important;
    }
}

/* DevExpress Popup Modal Styling
 * Note: Popup-based components (DxPopup, DxToast, etc.) do NOT support CSS isolation
 * because they render at the page root. Modal-specific styles are now defined inline
 * in each modal component using <style> blocks and BodyCssClass property.
 * See DEVEXPRESS_STYLING_PLAN.md for details.
 */

/* DevExpress Modal/Popup responsive */
@media (max-width: 767px) {
    /* Make modals full-width on mobile */
    .dxbs-modal-dialog {
        margin: 0;
        max-width: 100%;
        width: 100%;
        height: 100vh;
    }

    .dxbs-modal-content {
        border-radius: 0;
        height: 100vh;
        display: flex;
        flex-direction: column;
    }

    .dxbs-modal-body {
        flex: 1;
        overflow-y: auto;
    }

    .dxbs-modal-footer {
        flex-shrink: 0;
        /* Stack modal footer buttons vertically */
        display: flex;
        flex-direction: column-reverse;
        gap: 0.5rem;
    }

    .dxbs-modal-footer > * {
        width: 100%;
        margin: 0;
    }
}

/* DevExpress Button responsive */
@media (max-width: 767px) {
    /* Make buttons touch-friendly (min 44px height) */
    .dxbs-btn {
        min-height: 44px;
        padding: 0.5rem 1rem;
    }

    .btn {
        min-height: 44px;
    }
}

/* Mobile grid improvements */
@media (max-width: 767px) {
    /* Action buttons - larger touch targets */
    .action-buttons-mobile {
        display: flex;
        flex-direction: column;
        gap: 0.25rem;
        align-items: center;
    }

    .action-buttons-mobile .dxbs-btn,
    .action-buttons-mobile .dxbl-btn {
        min-width: 44px;
        min-height: 44px;
        padding: 0.5rem;
    }

    /* Hide pager text on mobile */
    .dxbl-pager-info {
        display: none;
    }

    /* Reduce grid cell padding on mobile */
    .dxbl-grid-data-cell,
    .dxbl-grid-header-cell {
        padding: 0.5rem 0.25rem !important;
    }

    /* Sticky first column on mobile for better UX */
    .dxbl-grid-data-cell:first-child,
    .dxbl-grid-header-cell:first-child {
        position: sticky;
        left: 0;
        background-color: var(--bs-body-bg);
        z-index: var(--z-sticky);
        box-shadow: 2px 0 4px rgba(0, 0, 0, 0.1);
    }

    /* Ensure proper grid scrolling on mobile */
    .dxbl-grid {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
}

/* Desktop action buttons */
.action-buttons {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    justify-content: flex-start;
}

/* Prevent action buttons from being truncated in grid cells */
.dxbl-grid-data-cell .action-buttons {
    overflow: visible !important;
    text-overflow: unset !important;
}

.action-buttons .dxbl-btn,
.action-buttons .dxbs-btn {
    flex-shrink: 0;
    overflow: visible !important; /* Don't clip icon content */
}

/* Ensure icon span doesn't clip wide icons */
.action-buttons .dxbl-btn .material-symbols-outlined,
.action-buttons .dxbs-btn .material-symbols-outlined {
    overflow: visible;
}

/* Utility classes for responsive design */
.mobile-only {
    display: none;
}

.desktop-only {
    display: block;
}

@media (max-width: 767px) {
    .mobile-only {
        display: block;
    }

    .desktop-only {
        display: none;
    }

    .mobile-stack {
        display: flex;
        flex-direction: column;
        gap: 0.5rem;
    }

    .mobile-full-width {
        width: 100%;
    }
}

/* Touch-friendly spacing */
@media (max-width: 767px) {
    /* Increase tap targets */
    .clickable,
    button,
    a,
    .dxbl-grid-data-row {
        min-height: 44px;
    }

    /* Add spacing between interactive elements */
    button + button,
    .btn + .btn {
        margin-top: 0.5rem;
    }

    /* Remove vertical spacing for horizontal button layouts */
    .action-buttons button + button,
    .action-buttons .btn + .btn,
    .dxbl-btn-group button + button,
    .dxbl-btn-group .btn + .btn,
    .scheduler-toolbar button + button,
    .scheduler-toolbar .btn + .btn,
    .dxbl-modal-footer button + button,
    .dxbl-modal-footer .btn + .btn {
        margin-top: 0;
    }
}

/* ========================================
   Utility Classes - Icon Sizing
   ======================================== */
.icon-xxs {
    font-size: 0.75em;
}

.icon-xs {
    font-size: 1.25em;
}

.icon-sm {
    font-size: 1.375em;
}

.icon-md {
    font-size: 1.5em;
}

.icon-base {
    font-size: 1.625em;
}

.icon-lg {
    font-size: 1.75em;
}

.icon-xl {
    font-size: 1.8125em;
}

.icon-2xl {
    font-size: 1.875em;
}

.icon-3xl {
    font-size: 2em;
}

.icon-4xl {
    font-size: 2.375em;
}

/* ========================================
   Utility Classes - Heights
   ======================================== */
.h-25-percent {
    height: 25%;
}

.h-40-percent {
    height: 40%;
}

.h-60-percent {
    height: 60%;
}

.h-75-percent {
    height: 75%;
}

.h-80vh {
    height: 80vh;
}

.h-84vh {
    height: 84vh;
}

.h-85vh {
    height: 85vh;
}

.h-86vh {
    height: 86vh;
}

.h-91vh {
    height: 91vh;
}

.min-h-0 {
    min-height: 0;
}

/* ========================================
   Utility Classes - Flexbox
   ======================================== */
.flex-center {
    display: flex;
    align-items: center;
}

.flex-center-justify {
    display: flex;
    align-items: center;
    justify-content: center;
}

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

.flex-end {
    display: flex;
    justify-content: flex-end;
}

.flex-row-gap {
    display: flex;
    flex-direction: row;
    justify-content: flex-end;
    gap: 8px;
}

/* ========================================
   Utility Classes - Interaction
   ======================================== */
.non-selectable {
    user-select: none;
}

.clickable-icon {
    cursor: pointer;
    user-select: none;
}

.default-cursor {
    cursor: default;
}

/* ========================================
   Utility Classes - Transforms
   ======================================== */
.rotate-180 {
    transform: rotate(180deg);
}

/* ========================================
   Utility Classes - Overflow
   ======================================== */
.overflow-y-auto {
    overflow-y: auto;
}

.overflow-x-hidden {
    overflow-x: hidden;
}

.overflow-hidden {
    overflow: hidden;
}

/* ========================================
   Utility Classes - Text
   ======================================== */
.text-nowrap {
    white-space: nowrap;
}

.font-italic {
    font-style: italic;
}

/* ========================================
   Utility Classes - Positioning
   ======================================== */
.position-relative-full {
    position: relative;
    height: 100%;
}

.position-absolute-full {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

/* ========================================
   Utility Classes - Spacing
   ======================================== */
.margin-block-sm {
    margin-block: 5px;
}

.padding-inline-lg {
    padding-inline: 5rem;
}

.margin-left-auto {
    margin-left: auto;
}

.margin-right-sm {
    margin-right: 5px;
}

.margin-left-sm {
    margin-left: 4px;
}

.margin-left-md {
    margin-left: 8px;
}

.margin-top-md {
    margin-top: 8px;
}

.margin-bottom-0 {
    margin-bottom: 0;
}

/* ========================================
   Utility Classes - Sizing
   ======================================== */
.w-auto {
    width: auto;
}

.h-auto {
    height: auto;
}

.h-inherit {
    height: inherit;
}

.h-18 {
    height: 1.125rem;
}

.h-24 {
    height: 1.5rem;
}

.min-width-0 {
    min-width: 0;
}

.max-width-100 {
    max-width: 100%;
}

/* ========================================
   Utility Classes - Display
   ======================================== */
.flex-1 {
    flex: 1;
}

.line-height-1 {
    line-height: 1;
}

.line-height-half {
    line-height: 0.5;
}

.vertical-align-middle {
    vertical-align: middle;
}

/* ========================================
   Utility Classes - Buttons & Forms
   ======================================== */
.btn-unstyled {
    padding: 0;
    border: none;
    background: none;
}

.bg-inherit-no-border {
    background-color: inherit;
    border: none;
}

/* ========================================
   Utility Classes - Text Sizing
   ======================================== */
.text-xs {
    font-size: 0.8em;
}

.text-sm {
    font-size: 0.875rem;
}

.text-base-sm {
    font-size: 0.9rem;
}

.text-center-italic-sm {
    font-size: 12px;
    text-align: center;
    font-style: italic;
}

/* ========================================
   Utility Classes - Image Handling
   ======================================== */
.object-fit-cover {
    object-fit: cover;
}

.object-fit-contain {
    object-fit: contain;
}

/* ========================================
   Help Drawer & Floating Button
   ======================================== */
.help-floating-button {
    position: fixed;
    top: 70px;
    right: 20px;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background-color: #6C65F0;
    color: white;
    border: none;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s, box-shadow 0.2s;
}

.help-floating-button:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.help-floating-button:focus {
    outline: 2px solid #6C65F0;
    outline-offset: 2px;
}

.help-button-icon {
    font-size: 20px;
    font-weight: bold;
}

/* Fix DxDrawer breaking flex height chain */
/* Use descendant selectors to catch all intermediate wrappers */
main > .dxbl-drawer {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
}

/* Target any intermediate wrapper between drawer and target */
main > .dxbl-drawer > * {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
}

main > .dxbl-drawer .dxbl-drawer-target {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
}

/* Ensure the drawer panel (side panel) doesn't affect layout */
main > .dxbl-drawer .dxbl-drawer-panel {
    flex: none;
}

/* Help Drawer Panel */
.help-drawer .dxbl-drawer-panel {
    max-width: 90vw;
    background-color: var(--bs-body-bg);
    box-shadow: -2px 0 8px rgba(0, 0, 0, 0.15);
}

.help-drawer-header {
    padding: 1rem 1.25rem;
}

.help-drawer-header h5 {
    margin: 0;
    color: var(--bs-heading-color, var(--bs-body-color));
    font-weight: 600;
}

.help-drawer-body {
    padding: 1.25rem;
    line-height: 1.6;
    color: var(--bs-body-color);
}

.help-drawer-body h5 {
    margin-top: 1rem;
    margin-bottom: 0.5rem;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--bs-heading-color, var(--bs-body-color));
}

.help-drawer-body h5:first-child {
    margin-top: 0;
}

.help-drawer-body p {
    margin-bottom: 0.75rem;
    color: var(--bs-light-text-emphasis);
}

.help-drawer-body ul {
    margin: 0.5rem 0;
    padding-left: 1.25rem;
}

.help-drawer-body li {
    margin-bottom: 0.25rem;
    color: var(--bs-light-text-emphasis);
}

.help-drawer-body code {
    background-color: var(--bs-tertiary-bg);
    color: var(--bs-body-color);
    padding: 0.125rem 0.375rem;
    border-radius: 3px;
    font-size: 0.875em;
    border: 1px solid var(--bs-border-color);
}

/* Mobile adjustments for help button */
@media (max-width: 575px) {
    .help-floating-button {
        top: auto;
        bottom: 20px;
        right: 20px;
    }
}
