:root
{
    --helpdesk-appbar-height: 56px;
}

.helpdesk-app-bar.mud-appbar
{
    min-height: var(--helpdesk-appbar-height) !important;
    background-color: var(--mud-palette-appbar-background) !important;
    color: var(--mud-palette-appbar-text) !important;
}

.helpdesk-app-bar.mud-appbar .mud-toolbar
{
    display: grid;
    grid-template-columns: minmax(220px, 1fr) minmax(220px, 420px) minmax(180px, 1fr);
    align-items: center;
    gap: 12px;
    min-height: var(--helpdesk-appbar-height) !important;
    height: var(--helpdesk-appbar-height) !important;
    padding: 0 10px 0 6px !important;
}

.helpdesk-nav-drawer.mud-drawer
{
    top: var(--helpdesk-appbar-height) !important;
    height: calc(100vh - var(--helpdesk-appbar-height)) !important;
}

.helpdesk-main-content
{
    padding-top: calc(var(--helpdesk-appbar-height) + 16px) !important;
    min-height: 100vh;
}

.helpdesk-appbar-left,
.helpdesk-appbar-actions
{
    display: flex;
    align-items: center;
    min-width: 0;
}

.helpdesk-appbar-actions
{
    justify-content: flex-end;
    gap: 4px;
}

.helpdesk-appbar-mobile-actions
{
    display: none;
    justify-content: flex-end;
    min-width: 0;
}

.helpdesk-appbar-chip.mud-chip
{
    height: 24px;
    border-color: rgba(255, 255, 255, 0.42);
    color: var(--mud-palette-appbar-text);
    font-weight: 800;
}

.helpdesk-appbar-api-chip.mud-chip
{
    min-width: 42px;
}

.helpdesk-appbar-version-anchor
{
    position: relative;
    display: inline-flex;
}

.helpdesk-version-popover-overlay
{
    position: fixed;
    inset: 0;
    z-index: 1200;
}

.helpdesk-version-popover
{
    z-index: 1300;
}

.helpdesk-version-container
{
    width: min(320px, calc(100vw - 24px));
    overflow: hidden;
    border-radius: 6px;
}

.helpdesk-version-content
{
    display: grid;
    gap: 12px;
    padding: 14px 12px 16px;
}

.helpdesk-version-section
{
    display: grid;
    gap: 4px;
}

.helpdesk-appbar-title
{
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.helpdesk-appbar-search-wrap
{
    display: flex;
    justify-content: center;
    min-width: 0;
}

.helpdesk-appbar-search
{
    width: min(420px, 42vw);
    height: 36px;
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 10px;
    border: 1px solid rgba(255, 255, 255, 0.22);
    border-radius: 6px;
    background: rgba(18, 18, 24, 0.34);
    color: var(--mud-palette-appbar-text);
    padding: 0 12px;
    font: inherit;
    font-weight: 700;
    text-align: left;
    cursor: pointer;
}

.helpdesk-appbar-search:hover,
.helpdesk-appbar-search:focus-visible
{
    background: rgba(18, 18, 24, 0.48);
    border-color: rgba(255, 255, 255, 0.42);
    outline: none;
}

.helpdesk-appbar-search kbd
{
    border: 1px solid rgba(255, 255, 255, 0.24);
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.12);
    color: var(--mud-palette-appbar-text);
    font-size: 0.68rem;
    font-weight: 800;
    line-height: 1;
    padding: 4px 6px;
    white-space: nowrap;
}

.global-search-backdrop
{
    position: fixed;
    inset: 0;
    z-index: 1400;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding: 80px 16px 24px;
    background: var(--mud-palette-overlay-dark);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

.global-search-panel
{
    width: min(100%, 640px);
    max-height: min(78dvh, 720px);
    overflow: hidden;
    border: 1px solid var(--mud-palette-divider);
    border-radius: 6px;
    background: var(--mud-palette-surface);
    color: var(--mud-palette-text-primary);
    box-shadow: 0 28px 90px rgba(0, 0, 0, 0.48);
}

.global-search-input-row
{
    display: grid;
    grid-template-columns: 28px 1fr;
    align-items: center;
    min-height: 52px;
    padding: 0 16px;
    border-bottom: 1px solid var(--mud-palette-divider);
    color: var(--mud-palette-text-secondary);
}

.global-search-input .mud-input > input
{
    color: var(--mud-palette-text-primary) !important;
    font-size: 1rem;
}

.global-search-input .mud-input > input::placeholder
{
    color: var(--mud-palette-text-secondary);
    opacity: 1;
}

.global-search-body
{
    max-height: calc(min(78dvh, 720px) - 52px);
    overflow: auto;
    padding: 18px 0;
}

.global-search-section-list,
.global-search-results
{
    padding: 0 4px;
}

.global-search-row,
.global-search-result,
.global-search-continue
{
    width: 100%;
    display: grid;
    align-items: center;
    border: 0;
    color: var(--mud-palette-text-primary);
    background: transparent;
    text-align: left;
    cursor: pointer;
}

.global-search-row
{
    grid-template-columns: 34px 1fr;
    min-height: 40px;
    padding: 0 16px;
    font-size: 0.96rem;
}

.global-search-result
{
    grid-template-columns: 34px minmax(0, 1fr) auto;
    gap: 2px;
    min-height: 52px;
    padding: 6px 16px;
}

.global-search-continue
{
    grid-template-columns: 34px minmax(0, 1fr) auto;
    min-height: 42px;
    padding: 0 16px;
    color: var(--mud-palette-info);
}

.global-search-row:hover,
.global-search-row:focus-visible,
.global-search-result:hover,
.global-search-result:focus-visible,
.global-search-continue:hover,
.global-search-continue:focus-visible
{
    background: var(--mud-palette-primary);
    outline: none;
}

.global-search-row .mud-icon-root,
.global-search-result .mud-icon-root,
.global-search-continue .mud-icon-root
{
    color: var(--mud-palette-success);
}

.global-search-row:hover .mud-icon-root,
.global-search-result:hover .mud-icon-root,
.global-search-continue:hover .mud-icon-root,
.global-search-row:focus-visible .mud-icon-root,
.global-search-result:focus-visible .mud-icon-root,
.global-search-continue:focus-visible .mud-icon-root
{
    color: var(--mud-palette-appbar-text);
}

.global-search-group-title
{
    padding: 12px 20px 6px;
    color: var(--mud-palette-text-secondary);
    font-size: 0.72rem;
    font-weight: 800;
    text-transform: uppercase;
}

.global-search-result-main
{
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.global-search-result-title,
.global-search-result-subtitle,
.global-search-result-meta,
.global-search-continue span
{
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.global-search-result-title
{
    font-weight: 700;
}

.global-search-result-subtitle,
.global-search-result-meta,
.global-search-empty,
.global-search-continue span:last-child
{
    color: var(--mud-palette-text-secondary);
    font-size: 0.82rem;
}

.global-search-loading,
.global-search-empty
{
    display: flex;
    justify-content: center;
    padding: 30px 16px;
}

.global-search-status
{
    display: grid;
    grid-template-columns: 34px minmax(0, 1fr);
    align-items: center;
    min-height: 42px;
    padding: 0 16px;
    color: var(--mud-palette-text-secondary);
    font-size: 0.82rem;
}

.ticket-header-card
{
    max-width: 100%;
    overflow: hidden;
}

.ticket-header-metadata-row
{
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px 8px;
    max-width: 100%;
    min-width: 0;
}

.ticket-header-chip.mud-chip,
.ticket-header-metadata-slot .mud-chip
{
    max-width: 100%;
    min-width: 0;
}

.ticket-header-chip .mud-chip-content,
.ticket-header-metadata-slot .mud-chip-content
{
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ticket-header-status-chip.mud-chip,
.ticket-header-priority-chip.mud-chip
{
    flex: 0 0 auto;
}

.ticket-header-requester-chip.mud-chip,
.ticket-header-metadata-slot .mud-chip
{
    flex: 0 1 auto;
}

.ticket-header-tracking-id,
.ticket-header-updated-at
{
    min-width: 0;
    max-width: 100%;
}

.ticket-header-tracking-id
{
    overflow-wrap: anywhere;
}

.ticket-header-updated-at
{
    white-space: nowrap;
}

.ticket-header-metadata-slot
{
    display: inline-flex;
    flex: 0 1 auto;
    min-width: 0;
    max-width: 100%;
}

.ticket-header-title,
.ticket-header-description
{
    overflow-wrap: anywhere;
}

.ticket-header-category-chip-set
{
    max-width: 100%;
    min-width: 0;
}

.ticket-header-category-chip-set .mud-chipset,
.ticket-header-category-chip-set .mud-chipset-content
{
    max-width: 100%;
    min-width: 0;
}

.ticket-header-category-chip.mud-chip
{
    max-width: 100%;
}

@media (max-width: 800px)
{
    .helpdesk-app-bar.mud-appbar .mud-toolbar
    {
        grid-template-columns: 44px minmax(0, 1fr) 44px;
        gap: 8px;
        padding: 0 8px !important;
    }

    .helpdesk-appbar-title
    {
        display: none;
    }

    .helpdesk-appbar-left
    {
        justify-content: flex-start;
    }

    .helpdesk-appbar-actions
    {
        display: none;
    }

    .helpdesk-appbar-mobile-actions
    {
        display: flex;
    }

    .helpdesk-appbar-mobile-actions .mud-icon-button,
    .helpdesk-appbar-left .mud-icon-button
    {
        width: 40px;
        height: 40px;
        padding: 8px;
    }

    .helpdesk-appbar-search
    {
        width: 100%;
        min-width: 0;
        grid-template-columns: auto minmax(0, 1fr);
        padding: 0 10px;
    }

    .helpdesk-appbar-search span
    {
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .helpdesk-appbar-search kbd
    {
        display: none;
    }

    .global-search-backdrop
    {
        padding-top: 64px;
    }

    .global-search-result,
    .global-search-continue
    {
        grid-template-columns: 30px minmax(0, 1fr);
    }

    .global-search-result-meta,
    .global-search-continue span:last-child
    {
        display: none;
    }

    .ticket-header-metadata-row
    {
        gap: 6px;
    }

    .ticket-header-tracking-id
    {
        flex: 1 1 7rem;
    }

    .ticket-header-updated-at
    {
        flex: 1 1 9rem;
    }

    .ticket-header-requester-chip.mud-chip,
    .ticket-header-metadata-slot,
    .ticket-header-metadata-slot .mud-chip
    {
        max-width: 100%;
    }
}

@media (orientation: portrait) and (max-width: 1024px)
{
    .helpdesk-app-bar.mud-appbar .mud-toolbar
    {
        grid-template-columns: 44px minmax(0, 1fr) 44px;
        gap: 8px;
        padding: 0 8px !important;
    }

    .helpdesk-appbar-title,
    .helpdesk-appbar-actions
    {
        display: none;
    }

    .helpdesk-appbar-mobile-actions
    {
        display: flex;
    }

    .helpdesk-appbar-left
    {
        justify-content: flex-start;
    }

    .helpdesk-appbar-search
    {
        width: 100%;
        min-width: 0;
        grid-template-columns: auto minmax(0, 1fr);
        padding: 0 10px;
    }

    .helpdesk-appbar-search span
    {
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .helpdesk-appbar-search kbd
    {
        display: none;
    }

    .ticket-header-metadata-row
    {
        align-items: flex-start;
    }

    .ticket-header-requester-chip.mud-chip,
    .ticket-header-metadata-slot .mud-chip
    {
        max-width: 100%;
    }
}

.helpdesk-public-main
{
    min-height: 100dvh;
    background: var(--mud-palette-background);
    padding-top: 0 !important;
}

.helpdesk-portal-page
{
    min-height: 100dvh;
    background: var(--mud-palette-background);
    padding: clamp(18px, 4vw, 36px) 16px clamp(36px, 6vw, 72px);
    position: relative;
}

.helpdesk-portal-admin
{
    display: flex;
    justify-content: flex-end;
    max-width: 1180px;
    margin: 0 auto;
}

.helpdesk-portal-content
{
    padding-top: clamp(40px, 8vh, 92px);
}

.helpdesk-portal-signature
{
    margin-bottom: 28px;
}

.helpdesk-portal-logo
{
    width: min(150px, 42vw);
    max-height: 132px;
    object-fit: contain;
}

.helpdesk-portal-company
{
    color: var(--mud-palette-text-secondary);
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.helpdesk-portal-action
{
    height: 100%;
    transition: transform 0.2s, box-shadow 0.2s;
    will-change: transform;
}

.helpdesk-portal-action:hover
{
    transform: translateY(-5px);
    box-shadow: 0 10px 20px color-mix(in srgb, var(--mud-palette-black) 10%, transparent) !important;
}

.helpdesk-login-page
{
    min-height: 100dvh;
    box-sizing: border-box;
    display: grid;
    place-items: start center;
    justify-items: center;
    padding: clamp(58px, 10vh, 84px) 16px 20px;
    background: var(--mud-palette-background);
    overflow-x: hidden;
}

.helpdesk-login-panel
{
    width: min(100%, 392px);
    overflow: hidden;
    padding: clamp(24px, 4vw, 32px);
    border-radius: 6px;
    border: 1px solid color-mix(in srgb, var(--mud-palette-secondary) 12%, transparent);
    background: var(--mud-palette-surface);
}

.helpdesk-login-header
{
    gap: 8px;
    margin-bottom: 22px;
    text-align: center;
}

.helpdesk-login-logo
{
    width: min(136px, 38vw);
    max-height: 112px;
    object-fit: contain;
}

.helpdesk-login-product
{
    margin: 2px 0 0;
    color: var(--mud-palette-secondary);
    font-size: 0.84rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.helpdesk-login-title
{
    margin: 0;
    color: var(--mud-palette-text-primary);
    text-align: center;
    font-size: clamp(2rem, 4vw, 2.3rem);
    line-height: 1.1;
}

.helpdesk-login-environment
{
    margin: 0;
    padding: 3px 12px;
    border: 1px solid color-mix(in srgb, var(--mud-palette-secondary) 28%, transparent);
    border-radius: 999px;
    color: var(--mud-palette-secondary);
    background: color-mix(in srgb, var(--mud-palette-secondary) 10%, var(--mud-palette-surface));
    font-weight: 600;
    font-size: 0.88rem;
}

.helpdesk-login-actions
{
    gap: 14px;
}

.helpdesk-login-copy,
.helpdesk-login-dev-copy
{
    color: var(--mud-palette-text-secondary);
    line-height: 1.55;
}

.helpdesk-login-copy
{
    max-width: 31ch;
    margin-inline: auto;
}

.helpdesk-login-primary-action
{
    min-height: 46px;
    background-color: var(--mud-palette-primary) !important;
    box-shadow: 0 4px 12px color-mix(in srgb, var(--mud-palette-primary) 28%, transparent);
    font-size: 0.98rem;
}

.helpdesk-login-dev-action
{
    min-height: 42px;
}

@media (max-width: 600px)
{
    .helpdesk-login-page
    {
        padding: 32px 12px 16px;
    }

    .helpdesk-login-panel
    {
        width: min(100%, 360px);
        padding: 22px 18px;
    }

    .helpdesk-login-title
    {
        font-size: 1.9rem;
    }
}

.notification-icons
{
    position: relative;
    gap: 4px;
}

.notification-icon
{
    position: relative;
    width: 40px;
    height: 40px;
}

.notification-badge .mud-badge-root
{
    position: relative;
}

.notification-badge .mud-badge
{
    top: 4px !important;
    right: 4px !important;
    transform: scale(0.9);
}

.notification-bell-anchor
{
    display: inline-flex;
}

.notification-popover
{
    width: 380px;
    max-width: 90vw;
    z-index: 1300;
}

.notification-popover-overlay
{
    position: fixed;
    inset: 0;
    z-index: 1200;
}

.notification-container
{
    width: 380px;
    max-width: 90vw;
    max-height: 70vh;
    display: flex;
    flex-direction: column;
}

.notification-content
{
    max-height: 70vh;
    display: flex;
    flex-direction: column;
}

.incident-list-scroll
{
    min-height: 0;
    flex-grow: 1;
    overflow-y: auto;
    overscroll-behavior: contain;
}

.incident-item
{
    border-left: 4px solid var(--mud-palette-divider);
    border-radius: 4px;
    margin: 4px 0;
    padding: 8px 8px 8px 10px;
}

.incident-item--critical
{
    border-left-color: var(--mud-palette-error);
    background-color: color-mix(in srgb, var(--mud-palette-error) 8%, transparent);
}

.incident-title
{
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.incident-message
{
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.ticket-message-container
{
    overflow-y: auto;
    max-height: calc(100vh - 260px);
    min-height: 200px;
}

.ticket-message-body
{
    color: var(--mud-palette-text-primary);
    overflow-wrap: anywhere;
}

.ticket-message-body :is(p, div, span, table, tbody, thead, tr, td, th, font, strong, b, em, i, u, li, ol, ul, blockquote, pre)
{
    color: var(--mud-palette-text-primary) !important;
}

.ticket-message-body a
{
    color: var(--mud-palette-primary) !important;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.ticket-message-body img
{
    max-width: 100%;
    height: auto;
}

@media (max-height: 800px)
{
    .ticket-message-container
    {
        max-height: calc(100vh - 200px);
    }
}

.compact-details-card .mud-card-content
{
    padding: 12px 12px 8px 12px;
}

.compact-details-card .mud-input-control
{
    margin-bottom: 6px;
}

.compact-details-card .mud-input-label
{
    font-size: 0.75rem;
}

.compact-details-card .mud-select-input,
.compact-details-card .mud-input-slot
{
    font-size: 0.85rem;
}

.compact-details-card .mud-card-header
{
    padding-bottom: 4px;
}

.compact-details-card .mud-card-actions
{
    padding-top: 6px;
}

.email-html-editor
{
    display: flex;
    flex-direction: column;
    gap: 12px;
    min-height: 560px;
}

.email-html-editor__toolbar
{
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}

.email-html-editor__placeholders
{
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    min-width: 0;
}

.email-html-editor__tenant
{
    width: 260px;
    flex: 0 0 auto;
}

.email-html-editor__surface
{
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(320px, 0.92fr);
    gap: 12px;
    min-height: 500px;
}

.email-html-editor__code,
.email-html-editor__preview
{
    min-width: 0;
    border: 1px solid var(--mud-palette-divider);
    border-radius: 8px;
    overflow: hidden;
    background: var(--mud-palette-surface);
}

.email-html-editor__monaco
{
    height: 500px;
}

.email-html-editor__preview
{
    display: flex;
    flex-direction: column;
}

.email-html-editor__preview-header
{
    min-height: 42px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 8px 12px;
    border-bottom: 1px solid var(--mud-palette-divider);
    background: var(--mud-palette-background-gray);
}

.email-html-editor__subject
{
    padding: 10px 12px;
    border-bottom: 1px solid var(--mud-palette-divider);
    font-weight: 600;
    color: var(--mud-palette-text-primary);
}

.email-html-editor__iframe
{
    width: 100%;
    flex: 1 1 auto;
    min-height: 420px;
    border: 0;
    background: #f3f7fb;
}

@media (max-width: 1100px)
{
    .email-html-editor__surface
    {
        grid-template-columns: 1fr;
    }

    .email-html-editor__tenant
    {
        width: 100%;
    }

    .email-html-editor__toolbar
    {
        flex-direction: column;
    }
}
