/* Production UI normalization */
:root {
    --icon-sm: 16px;
    --icon-md: 20px;
    --icon-lg: 24px;
    --space-1: 4px;
    --space-2: 8px;
    --space-3: 12px;
    --space-4: 16px;
    --space-5: 24px;
    --control-height: 42px;
}

button {
    font-family: inherit;
    box-sizing: border-box;
}
.primary-button {
    font-family: inherit;
    box-sizing: border-box;
}
.secondary-button {
    font-family: inherit;
    box-sizing: border-box;
}
.language-switch {
    font-family: inherit;
    box-sizing: border-box;
}
.row-action {
    font-family: inherit;
    box-sizing: border-box;
}
.profile-link {
    font-family: inherit;
    box-sizing: border-box;
}
.logout-button {
    font-family: inherit;
    box-sizing: border-box;
}

.primary-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    min-height: var(--control-height);
    white-space: nowrap;
}
.secondary-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    min-height: var(--control-height);
    white-space: nowrap;
}
.language-switch {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    min-height: var(--control-height);
    white-space: nowrap;
}
.modal-actions button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    min-height: var(--control-height);
    white-space: nowrap;
}
.org-actions button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    min-height: var(--control-height);
    white-space: nowrap;
}

.bi {
    display: inline-block;
    flex: 0 0 auto;
    width: 1em;
    height: 1em;
    font-size: var(--icon-sm);
    line-height: 1;
    text-align: center;
}

.bi:before {
    display: block;
    line-height: 1;
}

.nav-item > .bi {
    width: var(--icon-md);
    height: var(--icon-md);
    font-size: var(--icon-md);
}
.profile-link > .bi {
    width: var(--icon-md);
    height: var(--icon-md);
    font-size: var(--icon-md);
}
.logout-button > .bi {
    width: var(--icon-md);
    height: var(--icon-md);
    font-size: var(--icon-md);
}

.mobile-nav-trigger > .bi {
    width: var(--icon-lg);
    height: var(--icon-lg);
    font-size: var(--icon-lg);
}

.icon-button {
    display: inline-grid;
    place-items: center;
    position: relative;
    flex: 0 0 42px;
    padding: 0;
    cursor: pointer;
}

.icon-button > .bi {
    position: static;
    width: var(--icon-md);
    height: var(--icon-md);
    border-radius: 0;
    background: transparent;
    color: var(--green);
    font-size: var(--icon-md);
}

.icon-button > .notification-dot {
    position: absolute;
    inset-block-start: 7px;
    inset-inline-end: 7px;
    width: 7px;
    height: 7px;
    border: 2px solid var(--line);
    border-radius: 50%;
    background: var(--surface);
}

.notification-center {
    position: relative;
}

.notification-badge {
    position: absolute;
    inset-block-start: -5px;
    inset-inline-end: -6px;
    min-width: 19px;
    height: 19px;
    padding: 0 5px;
    display: grid;
    place-items: center;
    border: 2px solid var(--surface, #fff);
    border-radius: 999px;
    background: #d43f3a;
    color: #fff;
    font-size: 10px;
    font-weight: 800;
    line-height: 1;
}

.notification-panel {
    position: absolute;
    z-index: 120;
    inset-block-start: calc(100% + 12px);
    inset-inline-end: 0;
    width: min(390px, calc(100vw - 28px));
    max-height: min(560px, calc(100vh - 110px));
    overflow: hidden;
    border: 1px solid var(--line, #dbe5df);
    border-radius: 18px;
    background: var(--surface, #fff);
    color: var(--text, #17231d);
    box-shadow: 0 18px 50px rgba(12, 45, 32, 0.18);
}

.notification-panel--profile {
    position: fixed;
    z-index: 150;
    inset-block-start: auto;
    inset-block-end: 88px;
    inset-inline-end: 28px;
}

.notification-panel > .notification-panel__heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 17px 18px;
    border-bottom: 1px solid var(--line, #dbe5df);
}

.notification-panel > .notification-panel__heading span {
    color: var(--muted, #708078);
    font-size: 12px;
}

#notificationList {
    max-height: 390px;
    overflow-y: auto;
}

.notification-item {
    width: 100%;
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 15px 18px;
    border: 0;
    border-bottom: 1px solid var(--line, #e6ece8);
    background: transparent;
    color: inherit;
    text-align: start;
    cursor: pointer;
}

.notification-item:hover {
    background: color-mix(in srgb, var(--green, #087a55) 8%, transparent);
}
.notification-item:focus-visible {
    background: color-mix(in srgb, var(--green, #087a55) 8%, transparent);
}

.notification-item > i {
    margin-top: 2px;
    color: var(--green, #087a55);
    font-size: 20px;
}

.notification-item > span {
    min-width: 0;
    display: grid;
    gap: 3px;
}

.notification-item strong {
    font-size: 14px;
}

.notification-item b {
    direction: ltr;
    justify-self: start;
    color: var(--green, #087a55);
    font-size: 12px;
}

.notification-item small {
    color: var(--muted, #708078);
    font-size: 11px;
}
.notification-item time {
    color: var(--muted, #708078);
    font-size: 11px;
}

.notification-empty {
    min-height: 150px;
    display: grid;
    place-items: center;
    align-content: center;
    gap: 9px;
    color: var(--muted, #708078);
}

.notification-empty i {
    font-size: 28px;
}

.notification-loading-icon {
    animation: notification-spin 0.8s linear infinite;
}

@keyframes notification-spin {
    to {
        transform: rotate(360deg);
    }
}

#openApprovalsFromNotifications {
    width: calc(100% - 24px);
    margin: 12px;
    padding: 11px;
    display: flex;
    justify-content: center;
    gap: 8px;
    border: 0;
    border-radius: 11px;
    background: var(--green, #087a55);
    color: #fff;
    font-weight: 700;
    cursor: pointer;
}

html[data-theme='dark'] .notification-panel {
    background: #201635;
    border-color: #51416d;
    color: #fff;
}

html[data-theme='dark'] .notification-badge {
    border-color: #160b2d;
}

@media (max-width: 760px) {
    .notification-panel {
        position: fixed;
        inset-inline: 14px;
        inset-block-start: auto;
        inset-block-end: 74px;
        width: auto;
        max-height: calc(100dvh - 105px);
    }
    .notification-panel--profile {
        position: fixed;
        inset-inline: 14px;
        inset-block-start: auto;
        inset-block-end: 74px;
        width: auto;
        max-height: calc(100dvh - 105px);
    }
}

.row-action {
    display: inline-grid;
    place-items: center;
    flex: 0 0 36px;
    width: 36px;
    height: 36px;
    padding: 0;
    font-size: 0;
    cursor: pointer;
}

.row-action > .bi {
    width: var(--icon-sm);
    height: var(--icon-sm);
    margin: 0;
    font-size: var(--icon-sm);
}

.inline-actions {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    min-height: 100%;
}

.profile-chevron {
    margin-inline-start: auto;
    transition: transform 0.18s ease;
}

.chevron-open {
    transform: rotate(180deg);
}

.page-title {
    gap: var(--space-4);
    flex-wrap: wrap;
}

.page-title > div:first-child {
    min-width: 0;
}

.page-title h2 {
    overflow-wrap: anywhere;
}
.page-title p {
    overflow-wrap: anywhere;
}
.topbar h1 {
    overflow-wrap: anywhere;
}

.org-actions {
    align-items: center;
}

.workspace-card {
    min-width: 0;
    max-width: 100%;
}
.settings-content {
    min-width: 0;
    max-width: 100%;
}
.settings-grid {
    min-width: 0;
    max-width: 100%;
}
.mvc-grid {
    min-width: 0;
    max-width: 100%;
}

.ag-cell {
    overflow: hidden;
    text-overflow: ellipsis;
}

.ag-header-cell-text {
    white-space: normal;
    line-height: 1.45;
}

.employee-directory-toolbar {
    display: grid;
    grid-template-columns: minmax(260px, 1fr) repeat(3, minmax(150px, 220px));
    align-items: end;
    gap: 10px;
    margin-bottom: 14px;
}

.employee-directory-toolbar .search {
    width: 100%;
    margin: 0;
}

.employee-directory-toolbar > select {
    min-height: 42px;
    padding-inline: 11px;
    border: 1px solid var(--line);
    border-radius: 10px;
    color: var(--text);
    background: var(--surface);
}

.employee-primary-action {
    border-color: #245b43 !important;
    color: #fff !important;
    background: linear-gradient(135deg, #39775b, #245b43) !important;
    box-shadow: 0 8px 20px #245b4338;
}

.page-title .org-actions button {
    position: relative;
    min-height: 44px;
    padding-inline: 15px;
    border-radius: 11px;
    font-size: 12px;
    font-weight: 800;
    transition:
        transform 0.18s ease,
        box-shadow 0.18s ease,
        border-color 0.18s ease,
        background 0.18s ease,
        color 0.18s ease;
}

.page-title .org-actions .secondary-button {
    border-color: var(--line);
    color: var(--on-brand);
    background: var(--brand-purple);
    box-shadow: none;
}

.page-title .org-actions button > .bi {
    display: inline-grid;
    place-items: center;
    width: 25px;
    height: 25px;
    margin: 0;
    border-radius: 8px;
    color: inherit;
    background: color-mix(in srgb, currentColor 10%, transparent);
    transition:
        transform 0.18s ease,
        background 0.18s ease;
}

.page-title .org-actions button:hover {
    transform: translateY(-2px);
    box-shadow: none;
}

.page-title .org-actions .secondary-button:hover {
    border-color: var(--line);
    color: var(--on-brand);
    background: var(--brand-purple);
}

.page-title .org-actions button:hover > .bi {
    transform: scale(1.08) rotate(-4deg);
    background: color-mix(in srgb, currentColor 16%, transparent);
}

.page-title .org-actions button:active {
    transform: translateY(0) scale(0.98);
}

.employee-details__title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 26px;
    border-bottom: 1px solid var(--line);
    color: var(--text);
    font-size: 14px;
}

.employee-details__title button {
    width: 36px;
    height: 36px;
    display: grid;
    place-items: center;
    border: 1px solid var(--line);
    border-radius: 8px;
    color: var(--muted);
    background: transparent;
}

.employee-details__field.is-empty dd {
    color: var(--muted);
    font-weight: 500;
}

@media (max-width: 950px) {
    .employee-directory-toolbar {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 600px) {
    .employee-directory-toolbar {
        grid-template-columns: 1fr;
    }
}

.ag-theme-quartz .ag-header {
    position: sticky;
    top: 0;
    z-index: 5;
}

.employee-status-badge {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    min-width: 78px;
    padding: 5px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 800;
}

.employee-status-badge i {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: currentColor;
}

.employee-status-badge.is-active {
    color: #176746;
    background: #e7f6ef;
}

.employee-status-badge.is-inactive {
    color: #9b3c35;
    background: #fff0ee;
}

.employee-more-action {
    border: 1px solid #c7d5cd;
    border-radius: 10px;
    color: #285b45;
    background: #f7faf8;
    transition:
        transform 0.16s ease,
        background 0.16s ease,
        border-color 0.16s ease,
        box-shadow 0.16s ease;
}

.employee-more-action:hover {
    border-color: #39775b;
    color: #fff;
    background: #39775b;
    box-shadow: 0 7px 16px #245b4330;
    transform: translateY(-1px);
}

.employee-row-menu {
    position: fixed;
    z-index: 10020;
    display: grid;
    gap: 4px;
    width: 190px;
    padding: 7px;
    border: 1px solid #cbd8d1;
    border-radius: 12px;
    background: #fff;
    box-shadow: 0 18px 42px #12251b38;
}

.employee-row-menu button {
    display: flex;
    align-items: center;
    gap: 9px;
    width: 100%;
    min-height: 38px;
    padding: 8px 10px;
    border: 1px solid transparent;
    border-radius: 8px;
    background: #f8faf9;
    color: #243d31;
    font-family: inherit;
    font-size: 12px;
    line-height: 1.35;
    font-weight: 750;
    text-align: start;
    cursor: pointer;
    transition:
        color 0.15s ease,
        background 0.15s ease,
        border-color 0.15s ease,
        transform 0.15s ease;
}

.employee-row-menu button .bi {
    color: #39775b;
    font-size: 14px;
}

.employee-row-menu button:hover {
    border-color: #c9ddd2;
    background: #eaf5ef;
    color: #174b34;
    transform: translateX(-2px);
}

.employee-row-menu button.danger {
    color: #a4312a;
    background: #fff7f6;
}

.employee-row-menu button.danger .bi {
    color: #c24239;
}

.employee-row-menu button.danger:hover {
    border-color: #efbbb7;
    background: #fdeae8;
    color: #85231d;
}

html[data-theme='dark'] .employee-row-menu {
    border-color: #4b5f55;
    background: #1b2922;
    box-shadow: 0 20px 46px #0009;
}

html[data-theme='dark'] .employee-row-menu button {
    color: #edf7f1;
    background: #23372d;
}

html[data-theme='dark'] .employee-row-menu button:hover {
    border-color: #5f8c75;
    background: #315844;
}

html[data-theme='dark'] .employee-row-menu button.danger {
    color: #ffc5c0;
    background: #472825;
}

.employee-required-mark {
    color: #c43b32;
    font-weight: 900;
    margin-inline-start: 4px;
    display: inline-block;
    line-height: 1;
}

.employee-form-group {
    grid-column: 1 / -1;
    min-width: 0;
    margin: 0;
    padding: 16px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: var(--card-bg, #fff);
}

.employee-form-tabs {
    grid-column: 1 / -1;
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding: 4px 2px 8px;
    scrollbar-width: thin;
}

.employee-form-tab {
    flex: 0 0 auto;
    min-height: 40px;
    padding: 8px 14px;
    border: 1px solid var(--line);
    border-radius: 11px;
    color: var(--text);
    background: var(--surface);
    font-size: 12px;
    font-weight: 800;
    cursor: pointer;
}

.employee-form-tab:hover,
.employee-form-tab.is-active {
    color: var(--primary);
    border-color: var(--primary);
    background: var(--selection);
}

.employee-form-group[hidden] {
    display: none !important;
}

.employee-form-group legend {
    padding-inline: 8px;
    color: var(--green-dark, #315d49);
    font-size: 13px;
    font-weight: 800;
}

.employee-form-group__grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 13px 15px;
}

.employee-form-group .check {
    align-self: end;
    min-height: 39px;
}

html[data-theme='dark'] .employee-form-group {
    border-color: var(--line);
    background: var(--card-bg, #1b2922);
}

html[data-theme='dark'] .employee-form-group legend {
    color: #cfe8dc;
}

@media (max-width: 1000px) {
    .employee-form-group__grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 600px) {
    .employee-form-group {
        padding: 12px;
    }

    .employee-form-group__grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 760px) {
    .employee-directory-grid {
        --ag-cell-horizontal-padding: 9px;
    }

    .employee-directory-grid .ag-header-cell {
        padding-inline: 9px;
    }
    .employee-directory-grid .ag-cell {
        padding-inline: 9px;
    }
}

.topbar {
    min-width: 0;
}
.topbar__intro {
    min-width: 0;
}
.topbar__actions {
    min-width: 0;
}

.topbar__intro {
    flex: 1;
}

.topbar__actions {
    flex: 0 0 auto;
    flex-wrap: wrap;
}

.modal-actions {
    align-items: center;
    flex-wrap: wrap;
}

.select-trigger {
    gap: var(--space-2);
}

.select-trigger-value {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

@media (max-width: 1050px) {
    main {
        padding-inline: var(--space-5);
    }

    .page-title {
        align-items: flex-start;
    }

    .official-user-modal {
        width: min(960px, calc(100vw - 24px));
    }
}

@media (max-width: 760px) {
    main {
        padding: var(--space-4) var(--space-3) var(--space-5);
    }

    .topbar {
        display: grid;
        gap: var(--space-3);
    }

    .topbar__actions {
        width: 100%;
        justify-content: flex-start;
    }

    .topbar__actions .primary-button {
        flex: 1;
    }

    .metrics {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: var(--space-3);
    }

    .metrics article {
        padding: var(--space-4);
    }

    .page-title {
        display: grid;
        align-items: start;
    }

    .page-title .org-actions {
        width: 100%;
    }

    .page-title .org-actions > * {
        flex: 1;
    }

    .workspace-card {
        padding: var(--space-3);
    }

    .mvc-grid {
        height: min(590px, 65vh);
    }

    .official-user-permissions {
        grid-template-columns: 1fr;
    }

    .official-user-permissions fieldset:last-child {
        grid-column: auto;
    }

    .official-user-modal .official-user-permissions.active fieldset {
        height: 260px;
        min-height: 260px;
    }
}

@media (max-width: 480px) {
    .metrics {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .metrics article {
        min-width: 0;
        padding: 10px;
    }

    .topbar__actions {
        gap: var(--space-2);
    }

    .language-switch {
        padding-inline: 10px;
    }

    .topbar__actions .primary-button {
        width: 100%;
        flex-basis: 100%;
    }

    .official-user-fields {
        padding: var(--space-3);
    }

    .user-editor-tabs {
        display: grid;
        grid-template-columns: 1fr;
    }

    .modal-actions button {
        flex: 1;
    }

    .settings-toolbar {
        align-items: stretch;
        flex-wrap: wrap;
    }

    .settings-toolbar .search {
        flex: 1 0 100%;
    }
}

.field > .bi {
    width: var(--icon-sm);
    height: var(--icon-sm);
    font-size: var(--icon-sm);
}

.change-employee {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
}

.change-employee > .bi {
    width: var(--icon-sm);
    height: var(--icon-sm);
    font-size: var(--icon-sm);
}

.field-error {
    display: flex;
    align-items: flex-start;
    gap: 6px;
    margin-top: 1px;
    color: #c8323e;
    font-size: 9px;
    font-weight: 600;
    line-height: 1.75;
}

.field-error > .bi {
    flex: 0 0 var(--icon-sm);
    width: var(--icon-sm);
    height: var(--icon-sm);
    margin-top: 1px;
    font-size: var(--icon-sm);
}

.field-error > span {
    min-width: 0;
    overflow-wrap: anywhere;
}

.field-error.hidden {
    display: none !important;
}

.input-invalid {
    border-color: #dc3545 !important;
    background: #fff8f8 !important;
    box-shadow: 0 0 0 3px #dc354514 !important;
}

html[data-theme='dark'] .field-error {
    color: #fecaca;
}

html[data-theme='dark'] input.input-invalid {
    border-color: #f87171 !important;
    background: rgba(127, 29, 29, 0.16) !important;
    color: #f8fafc !important;
    box-shadow: 0 0 0 3px rgba(248, 113, 113, 0.16) !important;
}
