/* Dashboard layouts respond to their available content width, including resize and sidebar changes. */

.responsive-dashboard {
    container-name: hris-dashboard;
    container-type: inline-size;
    min-width: 0;
    max-width: 100%;
}

.responsive-dashboard :is(
    .dashboard-priority-grid,
    .dashboard-activity-grid,
    .dashboard-lower-grid,
    .dashboard-card
) {
    min-width: 0;
    max-width: 100%;
}

.responsive-dashboard .employee-request-card {
    container-name: employee-requests;
    container-type: inline-size;
}

/* Two columns are useful only when both panels retain a comfortable reading width. */
@container hris-dashboard (max-width: 72rem) {
    .responsive-dashboard :is(
        .dashboard-priority-grid,
        .dashboard-activity-grid,
        .dashboard-lower-grid
    ) {
        display: grid !important;
        grid-template-columns: minmax(0, 1fr) !important;
        gap: 1rem !important;
    }

    .responsive-dashboard :is(
        .dashboard-priority-grid,
        .dashboard-activity-grid,
        .dashboard-lower-grid
    ) > .dashboard-card {
        width: 100% !important;
        min-width: 0 !important;
        max-width: 100% !important;
    }
}

/* A narrow request panel uses one compact card per request instead of squeezing table columns. */
@container employee-requests (max-width: 36rem) {
    .responsive-dashboard .employee-request-table.unified-dashboard-table {
        display: grid;
        gap: .3rem;
        overflow: visible;
        border: 0;
        border-radius: 0;
        background: transparent;
    }

    .responsive-dashboard .employee-request-table .recent-leave-head {
        display: none !important;
    }

    .responsive-dashboard .employee-request-table .employee-request-row {
        display: grid !important;
        grid-template-columns: minmax(0, 1fr) !important;
        grid-template-areas:
            "employee"
            "request";
        gap: .22rem !important;
        width: 100%;
        min-width: 0;
        min-height: 0;
        padding: .42rem .5rem;
        border: 1px solid var(--dash-border);
        border-radius: 12px;
        background: var(--dash-panel, #ffffff);
    }

    .responsive-dashboard .employee-request-row > span {
        grid-area: employee;
        min-width: 0;
        color: var(--dash-text) !important;
        font-size: .82rem !important;
        font-weight: 750 !important;
        line-height: 1.3;
        white-space: normal;
        overflow-wrap: normal;
        word-break: normal;
    }

    .responsive-dashboard .employee-request-row > span.employee-request-name {
        font-weight: 400 !important;
    }

    .responsive-dashboard .employee-request-row > strong {
        grid-area: request;
        min-width: 0;
        padding: 0;
        color: var(--dash-text) !important;
        border: 0;
        border-radius: 0;
        background: transparent;
        font-size: .78rem !important;
        line-height: 1.3;
        white-space: normal;
        overflow-wrap: anywhere;
        word-break: normal;
    }

    .responsive-dashboard .employee-request-row small {
        color: var(--dash-muted) !important;
        font-size: .68rem !important;
        font-weight: 500 !important;
        line-height: 1.3;
    }

    .responsive-dashboard .employee-request-link {
        padding: .3rem .42rem;
    }
}

@container hris-dashboard (max-width: 40rem) {
    .responsive-dashboard {
        gap: .75rem;
    }

    .responsive-dashboard .summary-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    }

    .responsive-dashboard :is(.dashboard-card, .summary-card) {
        border-radius: 13px;
    }
}

@container hris-dashboard (max-width: 25rem) {
    .responsive-dashboard .summary-grid {
        grid-template-columns: minmax(0, 1fr) !important;
    }

    .responsive-dashboard .employee-request-table .employee-request-row {
        grid-template-columns: minmax(0, 1fr) auto !important;
        padding: .38rem .46rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    .responsive-dashboard *,
    .responsive-dashboard *::before,
    .responsive-dashboard *::after {
        transition-duration: .01ms !important;
    }
}
/* Notification drawer must escape the sticky header's backdrop-filter containing block. */
.top-row:has(.notification-drawer-backdrop) {
    z-index: 20000 !important;
    filter: none !important;
    -webkit-backdrop-filter: none !important;
    backdrop-filter: none !important;
    transform: none !important;
    perspective: none !important;
    contain: none !important;
    will-change: auto !important;
}

.notification-drawer-backdrop,
.hr-tools-modal {
    position: fixed !important;
    inset: 0 !important;
    width: 100vw !important;
    height: 100dvh !important;
    background: rgba(15, 23, 42, .48) !important;
    -webkit-backdrop-filter: blur(6px) !important;
    backdrop-filter: blur(6px) !important;
}

body:has(.notification-drawer-backdrop) .page {
    pointer-events: none !important;
    user-select: none !important;
}

body:has(.notification-drawer-backdrop) .notification-drawer-backdrop {
    pointer-events: auto !important;
    user-select: text !important;
}

/* Shared theme for the header controls and both right-side drawers. */
.theme-toggle,
.notification-button,
.hr-tools-button {
    width: 50px;
    height: 50px;
    flex: 0 0 50px;
    color: #475569;
    border: 1px solid #D7E1EA;
    border-radius: 999px;
    background: #FFFFFF;
    box-shadow: 0 4px 14px rgba(15, 23, 42, .05);
    transition: color .16s ease, border-color .16s ease, background-color .16s ease, box-shadow .16s ease, transform .16s ease;
}

.theme-toggle:hover,
.theme-toggle:focus-visible,
.notification-button:hover,
.notification-button:focus-visible,
.hr-tools-button:hover,
.hr-tools-button:focus-visible {
    color: #0F766E;
    border-color: #84CDC4;
    background: #ECFDF8;
    box-shadow: 0 7px 18px rgba(15, 118, 110, .13);
    outline: none;
    transform: translateY(-1px);
}

.notification-panel.notification-drawer,
.hr-tools-dialog,
.hr-tools-dialog.is-exporter {
    color: #334155;
    border-left-color: #D8E3ED;
    background: #FFFFFF;
}

.notification-panel.notification-drawer > header,
.hr-tools-dialog-header,
.hr-tools-dialog.is-exporter .hr-tools-dialog-header {
    color: #172033;
    border-bottom-color: #E5E7EB;
    background: #FFFFFF;
}

.notification-panel.notification-drawer .notification-drawer-title strong,
.hr-tools-dialog-header h2 {
    color: #0F766E;
}

.notification-drawer-title > span,
.hr-tools-dialog-title p {
    color: #64748B;
}

.notification-drawer-close,
.hr-tools-close {
    width: 38px;
    height: 38px;
    flex: 0 0 38px;
    display: grid;
    place-items: center;
    padding: 0;
    color: #64748B;
    border: 1px solid #DCE5EC;
    border-radius: 999px;
    background: #F1F5F9;
    box-shadow: 0 5px 14px rgba(51, 65, 85, .12);
    transition: color .16s ease, border-color .16s ease, background-color .16s ease, transform .16s ease;
}

.notification-drawer-close:hover,
.notification-drawer-close:focus-visible,
.hr-tools-close:hover,
.hr-tools-close:focus-visible {
    color: #FFFFFF;
    border-color: #64748B;
    background: #64748B;
    outline: 3px solid rgba(100, 116, 139, .16);
    transform: rotate(3deg);
}

.notification-item,
.hr-tool-panel,
.hr-tool-card {
    border-color: #DCE6EF;
    background: #FFFFFF;
}

.notification-item:hover,
.notification-item:focus-visible,
.hr-tool-card:hover,
.hr-tool-card:focus-visible,
.hr-tool-panel.is-open .hr-tool-card {
    border-color: #84CDC4;
    background: #F4FBFA;
}

.notification-mark-all,
.hr-tools-dialog .btn-primary {
    color: #FFFFFF;
    border-color: #0F766E;
    background: #0F766E;
}

.notification-mark-all:hover,
.notification-mark-all:focus-visible,
.hr-tools-dialog .btn-primary:hover,
.hr-tools-dialog .btn-primary:focus-visible {
    color: #FFFFFF;
    border-color: #0B625C;
    background: #0B625C;
    outline: 3px solid rgba(15, 118, 110, .16);
}

html[data-theme="dark"] .theme-toggle,
html[data-theme="dark"] .notification-button,
html[data-theme="dark"] .hr-tools-button {
    color: #C8D6DC;
    border-color: #2D434E;
    background: #132229;
    box-shadow: none;
}

html[data-theme="dark"] .theme-toggle:hover,
html[data-theme="dark"] .theme-toggle:focus-visible,
html[data-theme="dark"] .notification-button:hover,
html[data-theme="dark"] .notification-button:focus-visible,
html[data-theme="dark"] .hr-tools-button:hover,
html[data-theme="dark"] .hr-tools-button:focus-visible {
    color: #83E4DA;
    border-color: #3D8179;
    background: #173A35;
}

html[data-theme="dark"] .notification-panel.notification-drawer,
html[data-theme="dark"] .hr-tools-dialog,
html[data-theme="dark"] .hr-tools-dialog.is-exporter {
    color: #D5E2E6;
    border-left-color: #2D434E;
    background: #102129;
    box-shadow: -20px 0 48px rgba(0, 0, 0, .42);
}

html[data-theme="dark"] .notification-panel.notification-drawer > header,
html[data-theme="dark"] .hr-tools-dialog-header,
html[data-theme="dark"] .hr-tools-dialog.is-exporter .hr-tools-dialog-header {
    color: #F3F8FA;
    border-bottom-color: #2D434E;
    background: #102129;
}

html[data-theme="dark"] .notification-panel.notification-drawer .notification-drawer-title strong,
html[data-theme="dark"] .hr-tools-dialog-header h2 {
    color: #83E4DA;
}

html[data-theme="dark"] .notification-drawer-title > span,
html[data-theme="dark"] .hr-tools-dialog-title p {
    color: #94A3B8;
}

html[data-theme="dark"] .notification-drawer-close,
html[data-theme="dark"] .hr-tools-close {
    color: #C8D6DC;
    border-color: #37515D;
    background: #172B34;
    box-shadow: none;
}

html[data-theme="dark"] .notification-drawer-close:hover,
html[data-theme="dark"] .notification-drawer-close:focus-visible,
html[data-theme="dark"] .hr-tools-close:hover,
html[data-theme="dark"] .hr-tools-close:focus-visible {
    color: #FFFFFF;
    border-color: #4D6A76;
    background: #29404B;
}

html[data-theme="dark"] .notification-item,
html[data-theme="dark"] .hr-tool-panel,
html[data-theme="dark"] .hr-tool-card,
html[data-theme="dark"] .hr-tool-entry-form {
    color: #D5E2E6;
    border-color: #29404B;
    background: #132229;
}

html[data-theme="dark"] .notification-item strong,
html[data-theme="dark"] .hr-tool-card-copy strong {
    color: #F3F8FA;
}

html[data-theme="dark"] .notification-item span,
html[data-theme="dark"] .notification-item small,
html[data-theme="dark"] .hr-tool-card-copy small {
    color: #A8BAC3;
}

html[data-theme="dark"] .notification-item:hover,
html[data-theme="dark"] .notification-item:focus-visible,
html[data-theme="dark"] .notification-item.is-unread,
html[data-theme="dark"] .hr-tool-card:hover,
html[data-theme="dark"] .hr-tool-card:focus-visible,
html[data-theme="dark"] .hr-tool-panel.is-open .hr-tool-card {
    border-color: #3D8179;
    background: #173630;
}

/* HR tool launchers transition from the side drawer into centered tool windows. */
.hr-tools-modal.is-centered-tool {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    place-items: initial !important;
    place-content: initial !important;
    padding: 24px !important;
}

.hr-tools-modal.is-centered-tool .hr-tools-dialog {
    position: fixed !important;
    inset: auto !important;
    top: 50% !important;
    left: 50% !important;
    right: auto !important;
    bottom: auto !important;
    width: min(720px, calc(100vw - 48px));
    height: auto;
    max-height: calc(100dvh - 48px);
    margin: 0 !important;
    border: 1px solid #D8E3ED;
    border-radius: 18px;
    box-shadow: 0 28px 76px rgba(15, 23, 42, .28);
    transform: translate(-50%, -50%) !important;
    animation: hr-tool-window-fade-in .2s ease-out both;
}

.hr-tools-modal.is-centered-tool .hr-tools-dialog.is-exporter {
    width: min(980px, calc(100vw - 48px));
    height: min(820px, calc(100dvh - 48px));
    max-height: calc(100dvh - 48px);
}

.hr-tools-dialog.is-oath-window .hr-tools-grid {
    padding: 18px;
}

.hr-tools-dialog.is-oath-window .hr-tool-panel:not(.is-open) {
    display: none;
}

.hr-tools-dialog.is-oath-window .hr-tool-panel.is-open {
    overflow: visible;
    border: 0;
    background: transparent;
}

.hr-tools-dialog.is-oath-window .hr-tool-panel.is-open > .hr-tool-card {
    display: none;
}

.hr-tools-dialog.is-oath-window .hr-tool-entry-form {
    padding: 0;
    border: 0;
    background: transparent;
}

@keyframes hr-tool-window-fade-in {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Employee Request floating window: complete dark-theme coverage. */
html[data-theme="dark"] .employee-request-floating-window {
    color: #D5E2E6;
    border-color: #2D434E !important;
    background: #102129 !important;
    box-shadow: 0 28px 80px rgba(0, 0, 0, .5);
}

html[data-theme="dark"] .employee-request-floating-header {
    border-bottom-color: #2D434E !important;
    background: linear-gradient(135deg, #132B31, #173A35) !important;
}

html[data-theme="dark"] .employee-request-floating-header span {
    color: #83E4DA !important;
}

html[data-theme="dark"] .employee-request-floating-header h3 {
    color: #F3F8FA !important;
}

html[data-theme="dark"] .employee-request-floating-header button {
    border-color: #37515D !important;
    background: #172B34 !important;
}

html[data-theme="dark"] .employee-request-floating-header button::before,
html[data-theme="dark"] .employee-request-floating-header button::after {
    background: #C8D6DC !important;
}

html[data-theme="dark"] .employee-request-floating-body,
html[data-theme="dark"] .employee-request-floating-actions {
    color: #D5E2E6;
    border-color: #2D434E !important;
    background: #102129 !important;
}

html[data-theme="dark"] .employee-request-person-card,
html[data-theme="dark"] .employee-request-detail-grid > div {
    border-color: #29404B !important;
    background: #132229 !important;
}

html[data-theme="dark"] .employee-request-person-card strong,
html[data-theme="dark"] .employee-request-detail-grid dd {
    color: #F3F8FA !important;
}

html[data-theme="dark"] .employee-request-person-card small,
html[data-theme="dark"] .employee-request-detail-grid dt {
    color: #A8BAC3 !important;
}

html[data-theme="dark"] .employee-request-detail-grid dt {
    background: #132229 !important;
}

html[data-theme="dark"] .employee-request-status-chip {
    color: #83E4DA !important;
    border-color: #3D8179 !important;
    background: #173630 !important;
}

html[data-theme="dark"] .employee-request-photo-preview {
    color: #A9F1EA !important;
    border-color: #37515D !important;
    background: #172B34 !important;
}

html[data-theme="dark"] .employee-request-photo-preview:hover,
html[data-theme="dark"] .employee-request-photo-preview:focus-visible {
    border-color: #3D8179 !important;
    background: #173630 !important;
}

html[data-theme="dark"] .employee-request-photo-icon {
    background-color: #A9F1EA !important;
}

html[data-theme="dark"] .employee-request-floating-actions .btn-outline-secondary {
    color: #D5E2E6;
    border-color: #49616C;
    background: #172B34;
}

@media (max-width: 760px) {
    .hr-tools-modal.is-centered-tool {
        align-items: center !important;
        justify-content: center !important;
        padding: 10px !important;
    }

    .hr-tools-modal.is-centered-tool .hr-tools-dialog,
    .hr-tools-modal.is-centered-tool .hr-tools-dialog.is-exporter {
        width: calc(100vw - 20px);
        height: min(820px, calc(100dvh - 20px));
        max-height: calc(100dvh - 20px);
    }
}

/* Pending Employee Requests: keep document labels legible in dark mode. */
html[data-theme="dark"] .modern-dashboard .employee-request-table.unified-dashboard-table .employee-request-link,
html[data-theme="dark"] .modern-dashboard .employee-request-table.unified-dashboard-table .employee-request-link > span {
    color: #B8F3EC !important;
}

html[data-theme="dark"] .modern-dashboard .employee-request-table.unified-dashboard-table .employee-request-link > small {
    color: #A8BAC3 !important;
}

html[data-theme="dark"] .modern-dashboard .employee-request-table.unified-dashboard-table .employee-request-link:hover,
html[data-theme="dark"] .modern-dashboard .employee-request-table.unified-dashboard-table .employee-request-link:focus-visible,
html[data-theme="dark"] .modern-dashboard .employee-request-table.unified-dashboard-table .employee-request-link:hover > span,
html[data-theme="dark"] .modern-dashboard .employee-request-table.unified-dashboard-table .employee-request-link:focus-visible > span {
    color: #FFFFFF !important;
}

html[data-theme="dark"] .modern-dashboard .employee-request-table.unified-dashboard-table .employee-request-link.is-disabled,
html[data-theme="dark"] .modern-dashboard .employee-request-table.unified-dashboard-table .employee-request-link.is-disabled > span {
    color: #A8BAC3 !important;
}
