.helpdesk-user-cell {
    display: inline-flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.3rem 0.45rem;
    max-width: 100%;
}

.helpdesk-org-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.18rem;
    padding: 0.12rem 0.5rem 0.12rem 0.32rem;
    border-radius: 999px;
    font-size: 0.7rem;
    font-weight: 600;
    line-height: 1.2;
    letter-spacing: 0.01em;
    color: var(--tenant-primary, #582156);
    background: rgba(88, 33, 86, 0.1);
    border: 1px solid rgba(88, 33, 86, 0.2);
    white-space: nowrap;
    vertical-align: middle;
}

[data-theme='dark'] .helpdesk-org-badge {
    color: #e8d8ea;
    background: rgba(232, 216, 234, 0.14);
    border-color: rgba(232, 216, 234, 0.22);
}

.helpdesk-org-badge--contractor {
    color: #0f766e;
    background: rgba(15, 118, 110, 0.1);
    border-color: rgba(15, 118, 110, 0.22);
}

[data-theme='dark'] .helpdesk-org-badge--contractor {
    color: #5eead4;
    background: rgba(45, 212, 191, 0.14);
    border-color: rgba(45, 212, 191, 0.28);
}

.helpdesk-org-badge .material-icons {
    font-size: 0.95rem;
    width: 0.95rem;
    height: 0.95rem;
    line-height: 1;
}

/* Ticket modal header sits on tenant-primary — keep badge text readable */
.modal-header .helpdesk-org-badge,
.modal-header .helpdesk-org-badge--contractor {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.35);
}

.modal-header .helpdesk-org-badge .material-icons,
.modal-header .helpdesk-org-badge--contractor .material-icons,
.modal-header .helpdesk-org-badge .helpdesk-org-badge__text,
.modal-header .helpdesk-org-badge--contractor .helpdesk-org-badge__text {
    color: #ffffff;
}

[data-theme='dark'] .modal-header .helpdesk-org-badge,
[data-theme='dark'] .modal-header .helpdesk-org-badge--contractor {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.18);
    border-color: rgba(255, 255, 255, 0.32);
}

.addIncidentTitle {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.4rem 0.55rem;
}

.helpdesk-toolbar,
.page-action-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: stretch;
    max-width: 100%;
}

.helpdesk-toolbar .btn,
.page-action-toolbar .btn {
    flex: 0 1 auto;
}

.helpdesk-detail-section {
    margin-bottom: 1.25rem;
}

.helpdesk-detail-section:last-child {
    margin-bottom: 0;
}

.helpdesk-section-title {
    font-size: 0.95rem;
    font-weight: 600;
    margin-bottom: 0.65rem;
    color: var(--tenant-primary, #582156);
}

[data-theme='dark'] .helpdesk-section-title {
    color: #e8d8ea;
}

.helpdesk-messages {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.helpdesk-msg-box {
    background: #f4f4f6;
    border: 1px solid rgba(0, 0, 0, 0.06);
    border-radius: 10px;
    padding: 0.85rem 1rem;
}

[data-theme='dark'] .helpdesk-msg-box {
    background: #34343c;
    border-color: rgba(255, 255, 255, 0.08);
}

.helpdesk-msg-header {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 0.35rem 0.75rem;
    font-weight: 600;
    font-size: 0.9rem;
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
    padding-bottom: 0.45rem;
    margin-bottom: 0.55rem;
}

[data-theme='dark'] .helpdesk-msg-header {
    border-bottom-color: rgba(255, 255, 255, 0.1);
}

.helpdesk-msg-date {
    font-weight: 500;
    font-size: 0.82rem;
    color: #6c757d;
    white-space: nowrap;
}

[data-theme='dark'] .helpdesk-msg-date {
    color: rgba(255, 255, 255, 0.65);
}

.helpdesk-msg-body {
    margin: 0;
    white-space: pre-wrap;
    word-break: break-word;
    font-size: 0.92rem;
    line-height: 1.5;
}

.helpdesk-msg-body a {
    color: var(--tenant-primary, #582156);
    font-weight: 600;
    text-decoration: underline;
    text-underline-offset: 2px;
    word-break: break-all;
}

.helpdesk-msg-body a:hover,
.helpdesk-msg-body a:focus {
    color: color-mix(in srgb, var(--tenant-primary, #582156) 80%, #000);
}

[data-theme='dark'] .helpdesk-msg-body a {
    color: #e8d8ea;
}

[data-theme='dark'] .helpdesk-msg-body a:hover,
[data-theme='dark'] .helpdesk-msg-body a:focus {
    color: #fff;
}

.helpdesk-attachments {
    margin-top: 0.65rem;
}

.helpdesk-attachments .helpdesk-printscreens-grid--compact {
    margin-top: 0.65rem;
    margin-bottom: 0;
}

.helpdesk-reply-field .helpdesk-printscreens-grid--compact {
    margin-top: 0;
    margin-bottom: 0.65rem;
}

.helpdesk-screenshots-field .helpdesk-printscreens-grid--compact {
    margin-top: 0;
    margin-bottom: 0.5rem;
}

.helpdesk-screenshots-field .helpdesk-attachments {
    margin-top: 0;
}

.helpdesk-upload-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    margin-top: 0;
    padding: 0.4rem 0.85rem;
    line-height: 1.2;
    vertical-align: middle;
}

.helpdesk-upload-btn .material-icons {
    font-size: 1.125rem;
    line-height: 1;
    width: 1.125rem;
    height: 1.125rem;
}

.helpdesk-printscreens-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.helpdesk-printscreen-item {
    position: relative;
    width: 68px;
    height: 68px;
    flex: 0 0 68px;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid rgba(88, 33, 86, 0.18);
    background: #f8f8fa;
}

[data-theme='dark'] .helpdesk-printscreen-item {
    background: #2a2a30;
    border-color: rgba(255, 255, 255, 0.12);
}

.helpdesk-printscreen-thumb-btn {
    display: block;
    width: 100%;
    height: 100%;
    padding: 0;
    border: 0;
    background: transparent;
    cursor: zoom-in;
    position: relative;
}

.helpdesk-printscreen-placeholder {
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, #e8e8ec 0%, #f4f4f7 45%, #e8e8ec 90%);
    background-size: 200% 100%;
    animation: helpdesk-printscreen-shimmer 1.15s ease-in-out infinite;
}

[data-theme='dark'] .helpdesk-printscreen-placeholder {
    background: linear-gradient(90deg, #2e2e36 0%, #3a3a44 45%, #2e2e36 90%);
    background-size: 200% 100%;
}

@keyframes helpdesk-printscreen-shimmer {
    0% {
        background-position: 100% 0;
    }

    100% {
        background-position: -100% 0;
    }
}

.helpdesk-printscreen-thumb {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.helpdesk-printscreen-item--loaded .helpdesk-printscreen-thumb {
    opacity: 1;
}

.helpdesk-printscreen-item--loaded .helpdesk-printscreen-placeholder,
.helpdesk-printscreen-item--error .helpdesk-printscreen-placeholder {
    display: none;
}

.helpdesk-printscreen-item--error .helpdesk-printscreen-thumb-btn {
    cursor: default;
}

.helpdesk-printscreen-item--error::after {
    content: 'broken_image';
    font-family: 'Material Icons';
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.35rem;
    color: #9aa0a8;
    pointer-events: none;
}

[data-theme='dark'] .helpdesk-printscreen-item--error::after {
    color: rgba(255, 255, 255, 0.45);
}

@media (prefers-reduced-motion: reduce) {
    .helpdesk-printscreen-placeholder {
        animation: none;
        background: #ececf0;
    }

    [data-theme='dark'] .helpdesk-printscreen-placeholder {
        background: #34343c;
    }

    .helpdesk-printscreen-thumb {
        transition: none;
    }
}

.helpdesk-printscreen-delete {
    position: absolute;
    top: 3px;
    right: 3px;
    width: 22px;
    height: 22px;
    min-width: 22px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    background: rgba(220, 53, 69, 0.95);
    color: #fff;
    border: none;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
}

.helpdesk-printscreen-delete .material-icons {
    font-size: 0.9rem;
    line-height: 1;
}

.helpdesk-reply-field label {
    font-weight: 500;
}

.helpdesk-modal-footer-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
    flex-wrap: wrap;
}

#helpdeskPrintscreenLightbox .modal-content {
    background: rgba(20, 20, 24, 0.96);
    border: none;
}

#helpdeskPrintscreenLightbox .modal-header {
    border: none;
    padding-bottom: 0;
}

.helpdesk-lightbox-image {
    max-width: 100%;
    max-height: calc(100vh - 120px);
    width: auto;
    height: auto;
    object-fit: contain;
    border-radius: 8px;
}

@media (max-width: 768px) {
    .helpdesk-toolbar,
    .page-action-toolbar {
        flex-direction: column;
    }

    .helpdesk-toolbar .btn,
    .page-action-toolbar .btn {
        width: 100%;
        margin: 0 !important;
    }

    .helpdesk-printscreen-item {
        width: 60px;
        height: 60px;
        flex-basis: 60px;
    }

    .helpdesk-modal-footer-actions {
        width: 100%;
    }

    .helpdesk-modal-footer-actions .btn {
        flex: 1 1 auto;
    }
}
