:root {
    --rz-text-font-family: Roboto, 'Noto Naskh Arabic', sans-serif !important;
    --rz-icon-fill: 1;
    --rz-icon-optical-size: 48;
    --rz-icon-grade: 200;
}

@font-face {
    font-family: 'Noto Naskh Arabic';
    src: url('../fonts/NotoNaskhArabic-Variable.ttf') format('truetype-variations');
    font-weight: 400 700;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Material Symbols Rounded';
    font-style: normal;
    font-weight: 100 700;
    src: url('../fonts/MaterialSymbolsOutlined.woff2') format('woff2');
}

@font-face {
    font-family: 'Material Symbols Outlined';
    font-style: normal;
    font-weight: 100 700;
    src: url('../fonts/MaterialSymbolsOutlined.woff2') format('woff2');
}

.material-symbols-rounded {
    --rz-icon-font-family: 'Material Symbols Rounded';
}

.material-symbols-outlined {
    --rz-icon-font-family: 'Material Symbols Outlined';
}

:focus:not(:focus-visible) {
    outline: none;
}

#blazor-error-ui {
    background: lightyellow;
    bottom: 0;
    box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2);
    display: none;
    left: 0;
    padding: 0.6rem 1.25rem 0.7rem 1.25rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
}

    #blazor-error-ui .dismiss {
        cursor: pointer;
        position: absolute;
        right: 0.75rem;
        top: 0.5rem;
    }

.rz-data-grid .rz-custom-header .rz-variant-outlined .rz-form-field-content {
    margin-block: 0;
    box-shadow: var(--rz-button-shadow);
    border-radius: var(--rz-button-border-radius);
}


.rz-card.rz-variant-filled {
    background-color: var(--rz-form-field-label-floating-background-color);
}

.rz-form-field{
    width:100%
}

/* Edit dialogs: scrollable body with a footer that always stays in view. */
.dialog-form {
    display: flex;
    flex-direction: column;
    max-height: 85vh;
}

.dialog-scroll-body {
    flex: 0 1 auto;
    overflow-y: auto;
    min-height: 0;
    padding: 0.75rem 0.5rem;
}

.dialog-footer {
    flex: 0 0 auto;
    padding: 0.75rem;
    border-top: 1px solid var(--rz-base-300);
}

/* Dialogs go fullscreen on small/mobile viewports. */
@media (max-width: 768px) {
    .rz-dialog {
        width: 100vw !important;
        height: 100vh !important;
        max-width: 100vw !important;
        max-height: 100vh !important;
        border-radius: 0 !important;
    }

    .dialog-form {
        max-height: calc(100vh - 59px);
    }
}

.rz-dialog:not(.rz-dialog-confirm) .rz-dialog-content {
    padding: 0 !important;
}

.rz-dialog-titlebar {
    border-bottom: 1px solid var(--rz-base-300);
}

.rz-grid-table-fixed {
    table-layout: auto;
}

/* Rack elevation (Network Racks list) — CSS Grid, not a table: every U is one grid row,
   multi-U devices span rows via `grid-row: start / span n`. Avoids HTML table rowspan,
   which Blazor's diffing renders unreliably when sibling <td>s are conditionally skipped. */
.rack-elevation-grid {
    display: grid;
    grid-template-columns: 2.75rem 1fr;
    border: 1px solid var(--rz-base-300);
    border-radius: var(--rz-border-radius);
    overflow: hidden;
}

.rack-u-label {
    grid-column: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-variant-numeric: tabular-nums;
    color: var(--rz-text-secondary-color);
    background-color: var(--rz-base-100);
    border-bottom: 1px solid var(--rz-base-300);
    border-right: 1px solid var(--rz-base-300);
}

.rack-u-slot {
    grid-column: 2;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    padding: 0 0.5rem;
    border-bottom: 1px solid var(--rz-base-300);
    min-width: 0;
}

.rack-u-slot.occupied {
    background-color: var(--rz-form-field-label-floating-background-color);
}

.rack-u-slot .rack-u-device {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ============================================================
   Top app bar
   Flex bar replacing the old 5/7 column split: the title side
   truncates, the action side never shrinks. On phones the
   secondary actions live in the profile menu instead.
   ============================================================ */

.app-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    width: 100%;
    min-width: 0;
}

.app-topbar-start {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    flex: 1 1 auto;
    min-width: 0;
}

.app-topbar-crumb {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    flex-shrink: 0;
}

.app-topbar-title {
    font-weight: 600;
    font-size: 1.0625rem;
    letter-spacing: 0.01em;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
}

.app-topbar-end {
    display: flex;
    align-items: center;
    flex: 0 0 auto;
}

/* Client Portal account menu — plain <details>/<summary> so the dropdown needs no JS
   and the "Log out" control can be a real <form method="post"> submit button. */
.portal-account-menu {
    position: relative;
}

.portal-account-menu-trigger {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    height: 2.5rem;
    padding: 0 0.5rem 0 0.25rem;
    border-radius: calc(var(--rz-border-radius, 4px) + 16px);
    cursor: pointer;
    list-style: none;
}

.portal-account-menu-trigger-text {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    line-height: 1.15;
    overflow: hidden;
}

.portal-account-menu-name {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--rz-text-color);
    max-width: 10rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.portal-account-menu-email {
    font-size: 0.75rem;
    color: var(--rz-text-secondary-color);
    max-width: 10rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.portal-account-menu-trigger::-webkit-details-marker {
    display: none;
}

.portal-account-menu-trigger:hover {
    background-color: var(--rz-base-200);
}

.portal-account-menu-panel {
    position: absolute;
    right: 0;
    top: calc(100% + 0.25rem);
    min-width: 200px;
    background-color: var(--rz-base-background-color, #fff);
    border: 1px solid var(--rz-base-300);
    border-radius: var(--rz-border-radius);
    box-shadow: var(--rz-shadow-3, 0 2px 8px rgba(0, 0, 0, 0.15));
    padding: 0.25rem;
    z-index: 1000;
}

.portal-account-menu-panel form {
    margin: 0;
}

/* Duplicates what the trigger already shows on desktop — only needed once the
   trigger's own name/email text is hidden on phones (see the 767.98px query below). */
.portal-account-menu-header {
    display: none;
    flex-direction: column;
    padding: 0.5rem 0.75rem 0.625rem;
    margin-bottom: 0.25rem;
    border-bottom: 1px solid var(--rz-base-300);
}

.portal-account-menu-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
    padding: 0.5rem 0.75rem;
    border: none;
    background: none;
    color: var(--rz-text-color);
    text-decoration: none;
    text-align: left;
    font: inherit;
    border-radius: var(--rz-border-radius);
    cursor: pointer;
}

.portal-account-menu-item:hover {
    background-color: var(--rz-base-200);
    color: var(--rz-text-color);
}

/* Client Portal — pre-authentication pages (Login / SetPassword) are styled entirely via
   Blazor CSS isolation (PortalAuthLayout.razor.css), not here — plain HTML/CSS, no Radzen,
   scoped so it can't leak into or conflict with the rest of this stylesheet. */

/* Notification bell */
.app-bell {
    position: relative;
}

.app-bell .app-bell-badge {
    position: absolute;
    top: 2px;
    right: 0;
    pointer-events: none;
    font-size: 0.625rem;
    line-height: 1;
    padding: 3px 5px;
}

.app-bell-dropdown {
    position: absolute;
    right: 0;
    top: 100%;
    width: 360px;
    max-height: 420px;
    overflow-y: auto;
    z-index: 1000;
}

/* Global search (topbar) */
.app-search {
    position: relative;
    display: flex;
    align-items: center;
    flex: 0 0 auto;
}

.app-search-box {
    display: flex;
    align-items: center;
    gap: 0.355rem;
    width: 220px;
    padding: 0.25rem 0.625rem;
    border-bottom: 1px solid var(--rz-base-300);
}

.app-search-input {
    flex: 1 1 auto;
    min-width: 0;
    width: 100%;
    border: none;
    outline: none;
    background: transparent;
    color: var(--rz-text-color);
    font-size: 0.9rem;
}

.app-search-dropdown {
    position: absolute;
    right: 0;
    top: 100%;
    margin-top: 0.25rem;
    width: 320px;
    max-height: 420px;
    overflow-y: auto;
    z-index: 1000;
}

.app-search-group-label {
    display: block;
    margin: 0.5rem 0 0.125rem;
    color: var(--rz-text-tertiary-color, var(--rz-text-secondary-color));
}

.app-search-hit {
    cursor: pointer;
    padding: 0.4rem 0.5rem;
    border-radius: var(--rz-border-radius);
}

.app-search-hit:hover,
.app-search-hit-active {
    background: var(--rz-primary-lighter);
}

@media (max-width: 767.98px) {
    /* In client context the crumb is dropped; the client name is the title. */
    .app-topbar-crumb {
        display: none;
    }

    /* Keep only the avatar in the header on phones; name/email still show inside the
       dropdown panel once opened. */
    .portal-account-menu-trigger-text {
        display: none;
    }

    .portal-account-menu-header {
        display: flex;
    }

    /* Full-width sheet pinned under the header instead of a right-anchored
       popover that would overflow a 375px viewport. */
    .app-bell-dropdown {
        position: fixed;
        left: 0.5rem;
        right: 0.5rem;
        top: calc(var(--rz-header-min-height, 3.125rem) + 0.375rem);
        width: auto;
        max-height: 60vh;
        box-shadow: var(--rz-shadow-4);
    }

    .app-search {
        flex: 0 0 auto;
        max-width: none;
    }

    .app-search-box {
        position: fixed;
        left: 0.5rem;
        right: 0.5rem;
        top: calc(var(--rz-header-min-height, 3.125rem) + 0.375rem);
        z-index: 1001;
        box-shadow: var(--rz-shadow-4);
        background: var(--rz-body-background-color);
    }

    .app-search-dropdown {
        position: fixed;
        left: 0.5rem;
        right: 0.5rem;
        top: calc(var(--rz-header-min-height, 3.125rem) + 0.375rem + 2.5rem);
        width: auto;
        max-height: 60vh;
        box-shadow: var(--rz-shadow-4);
    }
}

/* ============================================================
   Responsive list view (ResponsiveListView<TItem>)
   Desktop: RadzenDataGrid unchanged. Mobile (<768px): card list
   + compact pager + fixed FAB. Colors come from Radzen theme
   variables so light/dark themes work without extra rules.
   ============================================================ */

/* Filter toolbar: wraps on desktop, controls stack full-width on mobile. */
.rlv-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
    margin-bottom: 0.75rem;
}

/* Mobile sort dropdown */
.rlv-sort {
    width: 100%;
    margin-bottom: 0.75rem;
}

/* Card list */
.rlv-cards {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.rlv-card {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    padding: var(--rz-card-padding);
    background: var(--rz-card-background-color);
    border: var(--rz-card-border);
    border-radius: var(--rz-card-border-radius);
    box-shadow: var(--rz-card-shadow);
}

.rlv-card:active {
    box-shadow: var(--rz-shadow-2);
}

/* Stretched link: whole-card tap navigates (or opens a dialog when used as a div
   with @onclick); inner action buttons sit above it via .rlv-card-actions. */
.rlv-card-link {
    position: absolute;
    inset: 0;
    z-index: 0;
    border-radius: inherit;
    cursor: pointer;
}

/* Clamp long text (e.g. notification messages) to two lines. */
.rlv-clamp2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.rlv-card-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.5rem;
}

.rlv-card-title {
    font-weight: 600;
    line-height: 1.3;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--rz-primary);
}

.rlv-card-sub {
    color: var(--rz-text-secondary-color);
    font-size: 0.875rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.rlv-card-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
    overflow: hidden;
    max-height: 1.7rem;
}

.rlv-card-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem 0.75rem;
    color: var(--rz-text-secondary-color);
    font-size: 0.8125rem;
}

.rlv-meta {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    min-width: 0;
}

.rlv-meta .rzi,
.rlv-meta .rz-icon {
    font-size: 1.125rem;
}

/* Action rail: right-aligned buttons that must not trigger card navigation. */
.rlv-card-actions {
    position: relative;
    z-index: 1;
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 0.5rem;
}

/* 48px minimum touch targets for icon buttons on cards. */
.rlv-iconbtn.rz-button {
    min-width: 44px;
    min-height: 44px;
}

/* Empty + loading states */
.rlv-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    padding: 2.5rem 1rem;
    text-align: center;
    color: var(--rz-text-secondary-color);
}

.rlv-loading {
    display: flex;
    justify-content: center;
    padding: 1rem;
}

.rlv-pager {
    margin-top: 0.5rem;
}

.rlv-pager .rz-paginator {
    flex-wrap: wrap;
    justify-content: center;
}

/* Skeleton placeholder cards */
.rlv-skel {
    background: var(--rz-base-300);
    border-radius: 4px;
    height: 0.9rem;
    animation: rlv-pulse 1.2s ease-in-out infinite;
}

.rlv-skel-title { width: 60%; height: 1.1rem; }
.rlv-skel-sub { width: 40%; }
.rlv-skel-meta { width: 80%; }

@keyframes rlv-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* FAB floats bottom-right above content, below dialogs (~1001) and #blazor-error-ui (1000) — on
   every viewport, not just mobile (a plain block-level .rlv-fab div is otherwise part of normal
   document flow and scrolls away with the page, which is not how a Material FAB behaves). */
.rlv-fab {
    position: fixed;
    right: 1rem;
    bottom: calc(1rem + env(safe-area-inset-bottom));
    z-index: 999;
}

.rlv-fab .rz-fab {
    box-shadow: var(--rz-shadow-3);
}

/* Clearance so the fixed FAB never covers the pager/last row/card, on any viewport. */
.rlv {
    padding-bottom: 4.5rem;
}

/* Mobile-only behavior */
@media (max-width: 767.98px) {
    /* Filters go full-width; beats inline style="width:260px" on existing pages. */
    .rlv-toolbar > *,
    .rlv-toolbar .rz-textbox,
    .rlv-toolbar .rz-dropdown {
        width: 100% !important;
    }

    .rlv-fab .rz-fab {
        width: 56px;
        height: 56px;
        min-width: 56px;
        padding: 0;
        justify-content: center;
    }

    /* Icon-only FAB on phones: the label costs width. */
    .rlv-fab .rz-button-text {
        display: none;
    }
}

/* ==========================================================================
   Tickets module (PortalTicketList, PortalTicketDetail) — deliberately
   global, not in the components' own scoped .razor.css. Several of these
   classes are applied directly to Radzen component tags (RadzenText,
   RadzenGravatar, RadzenDataGrid) — Blazor's CSS-isolation scope attribute is
   only ever added to plain HTML elements written literally in the .razor
   file, never forwarded onto a child component's own rendered root. A scoped
   rule targeting a class on <RadzenText> silently matches nothing (confirmed
   via computed-style checks 2026-08-31). Keep every ticket-domain class here,
   unscoped, mirroring the same section in the staff host's app.css.
   ========================================================================== */

/* Priority column renders 1-2 badges (priority + SLA) side by side — RadzenBadge carries no
   spacing of its own, so without this wrapper they render flush against each other. */
.ticket-priority-cell {
    display: inline-flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.375rem;
}

.ticket-unassigned {
    color: var(--rz-text-disabled-color);
    font-style: italic;
}

/* RadzenGravatar renders the class directly onto its own <img>, not onto a wrapper — target it
   with no descendant combinator. */
.ticket-avatar {
    width: 1.75rem;
    height: 1.75rem;
    border-radius: 50%;
}

.ticket-card {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    padding-inline-start: 0.75rem;
}

.ticket-grid .rz-data-row {
    cursor: pointer;
}

.ticket-back-button {
    align-self: flex-start;
}

.ticket-header {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    padding-inline-start: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--rz-base-300);
}

.ticket-opened-caption {
    margin: 0;
    color: var(--rz-text-secondary-color);
}

.ticket-reply-card {
    width: 100%;
    padding-inline-start: 0.75rem;
}

ul.rz-profile-menu {
    --rz-profile-menu-padding-inline: 1rem .5rem
}