/* ============================================================================
   HR ZONE — Layout Styles
   Sidebar, header, mobile menu, slide-in modals, configuration page
   ============================================================================ */

/* --- Sidebar --- */
#sidebar {
    background-color: #ffffff;
    color: #4b5563;
    border-right: 1px solid #e5e7eb;
    transition: width 0.3s ease-in-out, padding 0.3s ease-in-out;
}

#sidebar .border-b, #sidebar .border-t {
    border-color: #e5e7eb;
}

.dashboard-nav-item {
    color: #4b5563;
    font-weight: 500;
    font-size: 95%;
    border: none;
    transition: all 0.2s ease-in-out;
    border-radius: 6px;
}

.dashboard-nav-item:not(.active):hover {
    background-color: #f3f4f6;
    color: #111827;
}

.dashboard-nav-item.active {
    background-color: #fee2e2;
    color: var(--brand-red);
    font-weight: 600;
}

.dashboard-nav-item.active i {
    color: var(--brand-red);
}

/* --- Collapsed Sidebar Rules --- */
#sidebar.collapsed {
    width: 80px !important;
}

#sidebar.collapsed .dashboard-nav-item span.ml-3,
#sidebar.collapsed .dashboard-nav-item span.font-medium,
#sidebar.collapsed .sidebar-section-label {
    display: none !important;
}

#sidebar.collapsed .dashboard-nav-item i {
    margin-right: 0 !important;
    text-align: center;
    width: 100%;
    font-size: 1rem !important;
}

#sidebar.collapsed .dashboard-nav-item {
    justify-content: center !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
}

#sidebar.collapsed #brand-logo {
    display: none !important;
}

#sidebar.collapsed #brand-logo-collapsed {
    display: flex !important;
    width: 42px;
    height: 42px;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    background: #fff;
    border: 1px solid #e5e7eb;
    box-shadow: 0 8px 18px rgba(16, 17, 19, 0.08);
}

#management-links, #menu-links,
#support-settings-links, #admin-config-links {
    transition: max-height 0.4s ease-in-out, overflow 0.4s ease-in-out;
}

@media (min-width: 768px) {
    #main-content {
        transition: margin-left 0.3s ease-in-out;
    }
    #main-content.sidebar-collapsed {
        margin-left: 4.5rem;
    }
}

/* --- Header --- */
header {
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

#dashboard-title {
    margin-left: 0.5rem;
}

.header-action {
    height: 40px;
    width: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background 0.2s ease;
}

.header-action:hover {
    background: rgba(0,0,0,0.06);
}

.header-action .fa-bell {
    font-size: 1.1rem;
}

/* --- Toast Notifications --- */
.app-toast-container {
    position: fixed;
    top: calc(var(--header-h, 73px) + 1rem);
    right: 1rem;
    z-index: 2200;
    display: flex;
    width: min(24rem, calc(100vw - 2rem));
    flex-direction: column;
    gap: 0.75rem;
    pointer-events: none;
}

.app-toast {
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.9rem 1rem;
    overflow: hidden;
    pointer-events: auto;
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-left-width: 1px;
    border-radius: 10px;
    box-shadow: 0 18px 45px rgba(15, 23, 42, 0.16);
    opacity: 0;
    transform: translateY(-0.35rem);
    transition: opacity 0.18s ease, transform 0.18s ease;
}

.app-toast.is-visible {
    opacity: 1;
    transform: translateY(0);
}

.app-toast.is-leaving {
    opacity: 0;
    transform: translateY(-0.35rem);
}

.app-toast-icon {
    display: inline-flex;
    width: 2rem;
    height: 2rem;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    border-radius: 9999px;
    font-size: 0.8rem;
}

.app-toast-body {
    min-width: 0;
    padding-top: 0.05rem;
}

.app-toast-title {
    margin: 0 0 0.15rem;
    color: rgba(0, 0, 0, 0.84);
    font-size: 0.8125rem;
    font-weight: 600;
    line-height: 1.25;
}

.app-toast-message {
    margin: 0;
    color: rgba(0, 0, 0, 0.68);
    font-size: 0.78rem;
    line-height: 1.4;
}

.app-toast-close {
    display: inline-flex;
    width: 1.75rem;
    height: 1.75rem;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    border: 0;
    border-radius: 9999px;
    background: transparent;
    color: rgba(0, 0, 0, 0.45);
    cursor: pointer;
    transition: background 0.18s ease, color 0.18s ease;
}

.app-toast-close:hover {
    background: #f3f4f6;
    color: rgba(0, 0, 0, 0.8);
}

.app-toast-success {
    border-color: #d1fae5;
}

.app-toast-success .app-toast-icon {
    background: #dcfce7;
    color: #15803d;
}

.app-toast-error {
    border-color: #fecaca;
}

.app-toast-error .app-toast-icon {
    background: #fee2e2;
    color: var(--brand-red);
}

.app-toast-info {
    border-color: #dbeafe;
}

.app-toast-info .app-toast-icon {
    background: #dbeafe;
    color: #1d4ed8;
}

@media (max-width: 640px) {
    .app-toast-container {
        top: 0.75rem;
        right: 0.75rem;
        left: 0.75rem;
        width: auto;
    }
}

/* --- Asset-style List Modules --- */
.asset-list-module {
    display: flex;
    flex-direction: column;
    min-height: 0;
    min-width: 0;
    height: 100%;
    width: 100%;
    max-width: 100%;
    overflow: hidden;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 16px;
    box-shadow: 0 8px 22px rgba(15, 23, 42, 0.05);
}

.dashboard-tab.p-6 {
    min-height: calc(100vh - 82px);
}

#main-content,
#main-content > .flex-1,
.dashboard-tab,
.wc-dashboard-tab {
    min-width: 0;
    max-width: 100%;
}

.dashboard-tab,
.wc-dashboard-tab {
    overflow-x: hidden;
}

.portal-list-module.asset-list-module {
    display: flex !important;
    flex-direction: column;
    min-height: 0;
    min-width: 0;
    height: calc(100vh - 121px);
    width: 100% !important;
    max-width: 100% !important;
    overflow: hidden !important;
    background: #fff !important;
    border: 1px solid #e5e7eb !important;
    border-radius: 8px !important;
    padding: 16px !important;
    box-shadow: 0 8px 22px rgba(15, 23, 42, 0.05) !important;
}

.asset-list-module.hidden,
.portal-list-module.asset-list-module.hidden {
    display: none !important;
}

.module-editor-card {
    height: calc(100vh - 121px);
    min-height: 0;
}

.module-table-card {
    height: calc(100vh - 121px);
    min-height: 0;
}

.module-table-scroll {
    overscroll-behavior: contain;
}

.module-editor-body {
    overscroll-behavior: contain;
}

.asset-list-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 8px;
}

.portal-list-header.asset-list-header {
    display: flex !important;
    align-items: flex-start !important;
    justify-content: space-between !important;
    gap: 16px !important;
    margin-bottom: 10px !important;
}

.portal-list-header > div:first-child,
.portal-list-header > h3:first-child,
.portal-list-header > h4:first-child {
    min-width: 0;
}

.asset-list-title {
    margin: 0;
    font-size: 1.125rem;
    font-weight: 700;
    color: #1f2937;
}

.portal-list-title.asset-list-title {
    margin: 0 !important;
    font-size: 1.125rem !important;
    font-weight: 700 !important;
    color: #1f2937 !important;
}

.asset-list-subtitle {
    margin-top: 2px;
    color: #6b7280;
    font-size: 0.875rem;
}

.portal-list-subtitle.asset-list-subtitle {
    margin-top: 2px !important;
    color: #6b7280 !important;
    font-size: 0.875rem !important;
}

.asset-search-row {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 10px;
    min-width: 0;
    max-width: 100%;
}

.portal-table-search-row {
    flex-wrap: nowrap;
    position: relative;
    z-index: 40;
    overflow: visible;
    width: 100%;
    max-width: 100%;
}

.portal-table-search-row input[type="text"],
.portal-table-search-row input[type="search"] {
    min-width: 0 !important;
}

.portal-table-search-row .portal-search-row-tool {
    flex: 0 0 auto;
}

.portal-table-search-row .relative.portal-search-row-tool {
    display: inline-flex;
    position: relative;
    z-index: 45;
}

.app-topbar {
    z-index: 1000 !important;
    overflow: visible;
}

#wage-clerk-page .app-topbar {
    position: relative;
}

#notifications-modal,
#profile-dropdown,
#wc-profile-dropdown {
    z-index: 1010 !important;
}

#login-modal,
#change-password-modal,
#add-event-modal,
#profile-details-modal,
#profile-lightbox-modal,
#add-employee-modal,
#card-preview-modal {
    z-index: 1100 !important;
}

#filter-dropdown,
#handover-filter-dropdown,
#card-filter-dropdown,
#column-view-dropdown,
#handover-column-view-dropdown,
#card-column-view-dropdown,
[data-portal-column-dropdown] {
    right: 0 !important;
    left: auto !important;
    top: 100% !important;
    margin-top: 0.5rem !important;
    z-index: 80 !important;
    background: #fff !important;
    border: 1px solid #e5e7eb !important;
    border-radius: 0.375rem !important;
    box-shadow: 0 10px 15px -3px rgba(15, 23, 42, 0.12), 0 4px 6px -4px rgba(15, 23, 42, 0.12) !important;
    padding: 1rem !important;
}

#filter-dropdown,
#handover-filter-dropdown,
#card-filter-dropdown {
    width: 18rem !important;
    max-width: calc(100vw - 2rem) !important;
}

#column-view-dropdown,
#handover-column-view-dropdown,
#card-column-view-dropdown,
[data-portal-column-dropdown] {
    width: 14rem !important;
    max-width: calc(100vw - 2rem) !important;
}

#filter-dropdown h4,
#handover-filter-dropdown h4,
#card-filter-dropdown h4,
#column-view-dropdown h4,
#handover-column-view-dropdown h4,
#card-column-view-dropdown h4,
[data-portal-column-dropdown] h4 {
    margin-bottom: 1rem !important;
    color: #1f2937 !important;
    font-size: 1.125rem !important;
    font-weight: 700 !important;
    line-height: 1.4 !important;
}

.portal-legacy-search-hidden {
    display: none !important;
}

.asset-search-row input[type="text"] {
    flex: 1 1 520px;
    height: 42px;
    min-width: 260px;
    border: 1px solid #d1d5db;
    border-radius: 12px;
    padding: 10px 14px;
    color: #1f2937;
    background: #fff;
    font-size: 0.9rem;
}

.portal-list-module .portal-list-search,
.portal-list-module input[type="search"] {
    height: 42px;
    min-width: 240px;
    border: 1px solid #d1d5db !important;
    border-radius: 12px !important;
    padding: 10px 14px;
    color: #1f2937;
    background: #fff;
    font-size: 0.9rem;
}

.portal-list-module .portal-list-search:focus,
.portal-list-module input[type="search"]:focus {
    outline: none;
    border-color: var(--brand-red) !important;
    box-shadow: 0 0 0 4px rgba(216, 31, 38, 0.10);
}

.asset-search-row input[type="text"]:focus {
    outline: none;
    border-color: var(--brand-red);
    box-shadow: 0 0 0 4px rgba(216, 31, 38, 0.10);
}

.asset-icon-btn {
    width: 42px;
    height: 42px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 42px;
    border-radius: 12px;
    border: 1px solid #e5e7eb !important;
    background: #fff;
    color: #6b7280;
    transition: background 0.15s ease, color 0.15s ease, transform 0.15s ease;
}

.asset-icon-btn:hover {
    background: #fff1f2;
    border-color: #fecdd3 !important;
    color: var(--brand-red);
    transform: translateY(-1px);
}

.asset-clear-btn {
    color: #ef4444;
    border-color: #ef4444 !important;
}

.asset-clear-btn:hover {
    background: #fff1f2;
    border-color: #ef4444 !important;
    color: #ef4444;
}

.asset-table-wrap {
    flex: 1 1 auto;
    min-height: 0;
    min-width: 0;
    max-width: 100%;
    position: relative;
    z-index: 0;
    overflow: auto !important;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    background: #fff;
}

.asset-table-wrap table {
    width: max-content;
    min-width: 100%;
    max-width: none;
    table-layout: auto;
    border-collapse: separate;
    border-spacing: 0;
}

.asset-table-wrap thead {
    position: sticky;
    top: 0;
    z-index: 10;
    background: #f8fafc;
}

.asset-table-wrap th {
    padding: 10px 12px;
    border-bottom: 1px solid #e5e7eb;
    color: #64748b;
    font-size: 0.72rem;
    font-weight: 800;
    text-transform: uppercase;
    white-space: nowrap;
    overflow: visible;
    text-overflow: clip;
}

.asset-table-wrap th[data-sort-key] {
    cursor: pointer;
    user-select: none;
}

.asset-table-wrap th[data-sort-key] .th-label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.asset-table-wrap .sort-indicator {
    display: inline-flex;
    min-width: 10px;
    margin-left: 6px;
    color: var(--brand-red);
    font-size: 0.7rem;
}

.asset-table-wrap td {
    padding: 10px 12px;
    border-bottom: 1px solid #eef2f7;
    color: #374151;
    vertical-align: middle;
    white-space: nowrap;
    max-width: 18rem;
    overflow: hidden;
    text-overflow: ellipsis;
}

.asset-table-wrap tbody tr:hover {
    background: #fef2f2;
}

.portal-table-wrap {
    flex: 1 1 auto;
    min-height: 0;
    min-width: 0;
    max-height: none !important;
    max-width: 100%;
    position: relative;
    z-index: 0;
    overflow: auto !important;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    background: #fff;
}

.portal-table-enhanced {
    width: max-content;
    min-width: 100%;
    max-width: none;
    table-layout: auto;
    border-collapse: separate;
    border-spacing: 0;
}

.portal-table-enhanced thead {
    position: sticky;
    top: 0;
    z-index: 10;
    background: #f8fafc;
}

.portal-table-enhanced th {
    padding: 10px 12px;
    border-bottom: 1px solid #e5e7eb;
    color: #64748b;
    font-size: 0.72rem;
    font-weight: 800;
    text-transform: uppercase;
    white-space: nowrap;
    overflow: visible;
    text-overflow: clip;
}

.portal-table-enhanced td {
    padding: 10px 12px;
    border-bottom: 1px solid #eef2f7;
    color: #374151;
    vertical-align: middle;
    white-space: nowrap;
    max-width: 18rem;
    overflow: hidden;
    text-overflow: ellipsis;
}

.portal-table-enhanced tbody tr:hover {
    background: #fef2f2;
}

.dashboard-tab .asset-table-wrap,
.dashboard-tab .portal-table-wrap,
.wc-dashboard-tab .asset-table-wrap,
.wc-dashboard-tab .portal-table-wrap {
    width: 100%;
    max-width: 100%;
    overflow-x: auto !important;
    overflow-y: auto !important;
    contain: inline-size;
}

.dashboard-tab,
.wc-dashboard-tab,
.dashboard-tab > .asset-list-module,
.dashboard-tab > .wc-panel,
.dashboard-tab .wc-panel,
.dashboard-tab .module-table-card,
.wc-dashboard-tab .wc-panel {
    min-width: 0;
    max-width: 100%;
}

.dashboard-tab .asset-table-wrap table,
.dashboard-tab .portal-table-wrap table,
.wc-dashboard-tab .asset-table-wrap table,
.wc-dashboard-tab .portal-table-wrap table {
    width: max-content !important;
    min-width: 100% !important;
    max-width: none !important;
    table-layout: auto !important;
}

.dashboard-tab .asset-table-wrap th,
.dashboard-tab .asset-table-wrap td,
.dashboard-tab .portal-table-wrap th,
.dashboard-tab .portal-table-wrap td,
.wc-dashboard-tab .asset-table-wrap th,
.wc-dashboard-tab .asset-table-wrap td,
.wc-dashboard-tab .portal-table-wrap th,
.wc-dashboard-tab .portal-table-wrap td {
    min-width: 0;
    max-width: 18rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.dashboard-tab .asset-table-wrap th,
.dashboard-tab .portal-table-wrap th,
.wc-dashboard-tab .asset-table-wrap th,
.wc-dashboard-tab .portal-table-wrap th {
    max-width: none;
    overflow: visible;
    text-overflow: clip;
}

.asset-table-wrap table:has(thead th:first-child input[type="checkbox"]) th:first-child,
.asset-table-wrap table:has(thead th:first-child input[type="checkbox"]) td:first-child,
.portal-table-wrap table:has(thead th:first-child input[type="checkbox"]) th:first-child,
.portal-table-wrap table:has(thead th:first-child input[type="checkbox"]) td:first-child,
.asset-table-wrap th[data-col="select"],
.asset-table-wrap td[data-col="select"],
.portal-table-wrap th[data-col="select"],
.portal-table-wrap td[data-col="select"],
.app-table-select-cell {
    width: 42px !important;
    min-width: 42px !important;
    max-width: 42px !important;
    padding-left: 10px !important;
    padding-right: 10px !important;
    text-align: center;
}

.asset-table-wrap tbody tr.is-selected {
    background: #fff1f2;
}

#attendance-content .attendance-table-wrap,
#attendance-content .portal-table-wrap,
#attendance-content .asset-table-wrap {
    width: 100%;
    max-width: 100%;
    overflow-x: hidden !important;
}

#attendance-content #attendance-table,
#attendance-content .portal-table-enhanced {
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
    table-layout: fixed !important;
}

#attendance-content #attendance-table th,
#attendance-content #attendance-table td,
#attendance-content .portal-table-enhanced th,
#attendance-content .portal-table-enhanced td {
    min-width: 0 !important;
    max-width: none !important;
    white-space: normal !important;
    overflow-wrap: anywhere;
    word-break: normal;
}

#attendance-content #attendance-table th,
#attendance-content .portal-table-enhanced th,
#attendance-content #attendance-table td,
#attendance-content .portal-table-enhanced td {
    padding-left: 0.55rem;
    padding-right: 0.55rem;
}

#attendance-content #attendance-table th[data-col="select"],
#attendance-content #attendance-table td[data-col="select"] {
    width: 4% !important;
}

#attendance-content #attendance-table th[data-col="training"],
#attendance-content #attendance-table td[data-col="training"] {
    width: 11%;
}

#attendance-content #attendance-table th[data-col="employee-code"],
#attendance-content #attendance-table td[data-col="employee-code"] {
    width: 7%;
}

#attendance-content #attendance-table th[data-col="first-name"],
#attendance-content #attendance-table td[data-col="first-name"],
#attendance-content #attendance-table th[data-col="last-name"],
#attendance-content #attendance-table td[data-col="last-name"] {
    width: 8%;
}

#attendance-content #attendance-table th[data-col="job-title"],
#attendance-content #attendance-table td[data-col="job-title"] {
    width: 10%;
}

#attendance-content #attendance-table th[data-col="gender"],
#attendance-content #attendance-table td[data-col="gender"],
#attendance-content #attendance-table th[data-col="race"],
#attendance-content #attendance-table td[data-col="race"] {
    width: 5%;
}

#attendance-content #attendance-table th[data-col="date"],
#attendance-content #attendance-table td[data-col="date"] {
    width: 7%;
}

#attendance-content #attendance-table th[data-col="time"],
#attendance-content #attendance-table td[data-col="time"],
#attendance-content #attendance-table th[data-col="duration"],
#attendance-content #attendance-table td[data-col="duration"] {
    width: 6%;
}

#attendance-content #attendance-table th[data-col="attended"],
#attendance-content #attendance-table td[data-col="attended"] {
    width: 7%;
}

#attendance-content #attendance-table th[data-col="comment"],
#attendance-content #attendance-table td[data-col="comment"] {
    width: 8%;
}

#attendance-content #attendance-table th[data-col="actions"],
#attendance-content #attendance-table td[data-col="actions"] {
    width: 8%;
}

#attendance-content .attendance-status-select,
#attendance-content .attendance-comment-input {
    width: 100%;
    min-width: 0 !important;
}

.portal-list-module .asset-icon-btn {
    width: 42px !important;
    height: 42px !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    flex: 0 0 42px;
    border-radius: 12px !important;
    border: 1px solid #e5e7eb !important;
    background: #fff !important;
    color: #6b7280 !important;
    padding: 0 !important;
    box-shadow: none !important;
    transition: background 0.15s ease, color 0.15s ease, transform 0.15s ease;
}

.portal-list-module .asset-icon-btn:hover {
    background: #fff1f2 !important;
    border-color: #fecdd3 !important;
    color: var(--brand-red) !important;
    transform: translateY(-1px);
}

.portal-list-module .asset-clear-btn {
    color: #ef4444 !important;
    border-color: #ef4444 !important;
}

.portal-list-module .asset-clear-btn:hover {
    background: #fff1f2 !important;
    border-color: #ef4444 !important;
    color: #ef4444 !important;
}

.portal-table-enhanced th[data-portal-draggable="true"] {
    cursor: grab;
    user-select: none;
}

.portal-table-enhanced th[data-portal-draggable="true"]:active {
    cursor: grabbing;
}

.portal-table-enhanced th.dragging {
    opacity: 0.55;
}

.portal-table-enhanced th.drag-over {
    box-shadow: inset 3px 0 0 var(--brand-red);
}

.portal-table-enhanced th[data-portal-sortable="true"] .th-label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.portal-table-enhanced .sort-indicator {
    display: inline-flex;
    min-width: 10px;
    margin-left: 6px;
    color: var(--brand-red);
    font-size: 0.7rem;
}

.asset-table-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 2px 0;
    color: #64748b;
    font-size: 0.82rem;
}

.asset-table-footer.hidden {
    display: none;
}

.asset-pagination-actions {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.asset-pagination-page {
    color: #334155;
    font-weight: 700;
    white-space: nowrap;
}

.asset-page-btn {
    width: 34px;
    height: 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    background: #fff;
    color: #64748b;
    transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.asset-page-btn:hover:not(:disabled) {
    background: #fff1f2;
    border-color: #fecdd3;
    color: var(--brand-red);
}

.asset-page-btn:disabled {
    cursor: not-allowed;
    opacity: 0.45;
}

.asset-page-size-select {
    height: 34px;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    background: #fff;
    color: #334155;
    padding: 0 28px 0 10px;
    font-size: 0.82rem;
}

@media (max-width: 640px) {
    .asset-table-footer {
        align-items: flex-start;
        flex-direction: column;
    }

    .portal-list-module {
        height: auto;
        min-height: calc(100vh - 121px);
    }

    .portal-list-header {
        flex-direction: column;
    }

    .portal-table-search-row {
        flex-wrap: wrap;
    }
}

.training-list-module {
    height: calc(100vh - 121px);
}

/* --- Mobile Menu --- */
.mobile-menu {
    transform: translateY(-10px);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.mobile-menu.menu-open {
    transform: translateY(0);
    opacity: 1;
    pointer-events: auto;
}

.mobile-menu a, .mobile-menu button {
    opacity: 0;
    transform: translateX(-15px);
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.mobile-menu.menu-open a:nth-child(1), .mobile-menu.menu-open button:nth-child(1) {
    transition-delay: 0.1s;
}

.mobile-menu.menu-open a:nth-child(2), .mobile-menu.menu-open button:nth-child(2) {
    transition-delay: 0.15s;
}

.mobile-menu.menu-open a:nth-child(3), .mobile-menu.menu-open button:nth-child(3) {
    transition-delay: 0.2s;
}

.mobile-menu.menu-open a:nth-child(4), .mobile-menu.menu-open button:nth-child(4) {
    transition-delay: 0.25s;
}

.mobile-menu.menu-open a:nth-child(5), .mobile-menu.menu-open button:nth-child(5) {
    transition-delay: 0.3s;
}

.mobile-menu.menu-open a:nth-child(6), .mobile-menu.menu-open button:nth-child(6) {
    transition-delay: 0.35s;
}

/* --- Sidebar Refinements --- */
#sidebar {
    background-color: #ffffff !important;
    color: #4b5563 !important;
    border-right: 1px solid #e5e7eb !important;
}

#sidebar.collapsed .dashboard-nav-item:not(.active) {
    background-color: transparent !important;
}

#sidebar.collapsed .dashboard-nav-item.active {
    background-color: #fee2e2 !important;
}

#sidebar.collapsed .dashboard-nav-item:hover {
    background-color: #f3f4f6 !important;
}

#sidebar.collapsed {
    width: 4.5rem;
    padding-left: 0.5rem;
    padding-right: 0.5rem;
}

#sidebar.collapsed .p-4.border-b {
    padding: 0.75rem 0.5rem;
}

#sidebar.collapsed .dashboard-nav-item {
    justify-content: center;
    padding-left: 0.5rem;
    padding-right: 0.5rem;
}

#sidebar.collapsed .dashboard-nav-item i {
    margin-right: 0 !important;
    width: 100% !important;
    text-align: center;
}

#sidebar.collapsed .dashboard-nav-item span {
    display: none;
}

#sidebar.collapsed #training-toggle,
#sidebar.collapsed #workforce-toggle,
#sidebar.collapsed #system-toggle {
    display: none;
}

#sidebar.collapsed #training-links,
#sidebar.collapsed #workforce-links,
#sidebar.collapsed #system-links,
#sidebar.collapsed #admin-restricted-links {
    display: contents;
}

/* --- Slide-in Modals --- */
:root {
    --portal-drawer-top: 73px;
    --portal-drawer-width: 42rem;
    --portal-details-panel-top: clamp(8rem, 39vh, 23rem);
    --portal-details-panel-width: 25rem;
    --portal-details-panel-gap: 0.75rem;
}

#training-details-modal, #card-details-modal, #trainer-ranking-modal {
    box-shadow: var(--shadow);
    border-left: 1px solid rgba(0,0,0,0.06);
}

#training-details-modal,
#handover-details-modal,
#card-details-modal,
#assessment-create-modal,
#assessment-detail-modal {
    top: var(--portal-drawer-top) !important;
    right: 0 !important;
    bottom: 0 !important;
    left: 0 !important;
    height: auto !important;
    z-index: 1200 !important;
}

#handover-panel,
#card-panel,
#assessment-create-panel,
#assessment-detail-panel {
    top: 0 !important;
    right: 0 !important;
    width: 100% !important;
    max-width: var(--portal-drawer-width) !important;
    height: 100% !important;
    max-height: 100% !important;
    border-radius: 0 !important;
}

#training-panel {
    position: fixed !important;
    top: var(--portal-drawer-top) !important;
    right: 0 !important;
    width: 100% !important;
    max-width: var(--portal-drawer-width) !important;
    height: calc(100vh - var(--portal-drawer-top)) !important;
    max-height: calc(100vh - var(--portal-drawer-top)) !important;
    z-index: 1201 !important;
    border-radius: 0 !important;
}

#trainer-ranking-modal {
    top: var(--portal-drawer-top) !important;
    right: 0 !important;
    width: 100% !important;
    max-width: var(--portal-drawer-width) !important;
    height: calc(100vh - var(--portal-drawer-top)) !important;
    max-height: calc(100vh - var(--portal-drawer-top)) !important;
    border-radius: 0 !important;
}

#handover-side-modal {
    top: var(--portal-details-panel-top) !important;
    bottom: auto !important;
    width: calc(100% - 2rem) !important;
    max-width: var(--portal-details-panel-width) !important;
    height: auto !important;
    max-height: calc(100% - var(--portal-details-panel-top) - 1rem) !important;
    border-radius: 0 !important;
}

#training-side-modal {
    top: auto !important;
    right: calc(var(--portal-drawer-width) + var(--portal-details-panel-gap)) !important;
    bottom: 0 !important;
    width: calc(100% - 2rem) !important;
    max-width: var(--portal-details-panel-width) !important;
    height: auto !important;
    max-height: calc(100% - 4rem) !important;
    border-radius: 18px 18px 0 0 !important;
}

@media (min-width: 768px) {
    #handover-side-modal {
        width: 100% !important;
    }

    #training-side-modal {
        width: var(--portal-details-panel-width) !important;
    }
}

@media (max-width: 767px) {
    #training-side-modal {
        right: 0.75rem !important;
        left: 0.75rem !important;
        width: auto !important;
        max-width: none !important;
        max-height: calc(100% - 2rem) !important;
    }
}

#training-side-modal > div,
#handover-side-modal > div,
#training-panel > div,
#handover-panel > div,
#card-panel > div,
#assessment-create-panel > div,
#assessment-detail-panel > div,
#trainer-ranking-modal > div {
    border-radius: 0 !important;
}

#training-side-modal > div:first-child {
    border-radius: 18px 18px 0 0 !important;
}

.assessment-detail-layout {
    width: 100%;
    align-items: stretch;
}

#assessments-content.assessment-create-view-active,
#assessments-content.assessment-detail-view-active {
    height: calc(100vh - var(--portal-drawer-top));
    min-height: 0 !important;
    overflow: hidden;
}

#assessments-content.assessment-create-view-active #assessment-create-inline-host,
#assessments-content.assessment-detail-view-active #assessment-detail-inline-host {
    height: 100%;
    min-height: 0;
    overflow: hidden;
}

#assessment-create-inline-host {
    height: 100%;
    min-height: 0;
    overflow: hidden;
}

#assessment-create-inline-host #assessment-create-modal {
    position: relative !important;
    inset: auto !important;
    z-index: auto !important;
    height: 100% !important;
    max-height: 100% !important;
    min-height: 0;
    overflow: hidden;
}

#assessment-create-inline-host #assessment-create-form {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
}

#assessment-create-inline-host #assessment-create-panel {
    flex: 1 1 auto !important;
    width: auto !important;
    max-width: none !important;
    height: 100% !important;
    min-height: 0 !important;
}

#assessment-create-inline-host .assessment-create-main-pane,
#assessment-create-inline-host .assessment-create-preview-pane,
#assessment-create-inline-host .assessment-create-preview-body {
    min-height: 0;
}

#assessment-create-inline-host .assessment-create-main-pane {
    overflow-y: auto;
}

#assessment-create-inline-host .assessment-create-preview-footer {
    display: block;
}

#assessment-detail-inline-host #assessment-detail-modal {
    top: auto !important;
    right: auto !important;
    bottom: auto !important;
    left: auto !important;
    height: 100% !important;
    min-height: 0 !important;
    overflow: hidden;
    z-index: auto !important;
}

#assessment-detail-inline-host #assessment-detail-panel {
    flex: 1 1 auto !important;
    width: auto !important;
    max-width: none !important;
    height: 100% !important;
    min-height: 0 !important;
}

.assessment-detail-main {
    flex: 1 1 auto !important;
    width: auto !important;
    max-width: none !important;
    min-width: 0;
    height: 100% !important;
    min-height: 0 !important;
}

.assessment-detail-scroll {
    overflow-y: auto !important;
    min-height: 0;
    overscroll-behavior: contain;
}

.assessment-detail-summary {
    flex: 0 0 var(--portal-details-panel-width) !important;
    width: var(--portal-details-panel-width) !important;
    max-width: var(--portal-details-panel-width) !important;
    height: 100% !important;
    min-height: 0 !important;
}

@media (min-width: 1280px) {
    .assessment-detail-layout {
        justify-content: flex-end;
    }

    .assessment-detail-main {
        flex: 1 1 auto !important;
        width: auto !important;
        max-width: none !important;
    }

    .assessment-detail-summary {
        flex: 0 0 var(--portal-details-panel-width) !important;
        width: var(--portal-details-panel-width) !important;
    }
}

/* --- Configuration Page --- */
.config-sidebar-link {
    display: block;
    padding: 0.75rem 1.5rem;
    font-size: 14px;
    font-weight: 500;
    color: #4b5563;
    border-radius: 6px;
    transition: all 0.2s ease;
}

.config-sidebar-link:hover {
    background-color: #f3f4f6;
}

.config-sidebar-link.active {
    background-color: #fee2e2;
    color: var(--brand-red);
    font-weight: 600;
}

.config-main-section {
    display: none;
}

.config-main-section.active {
    display: block;
}
