html, body {
    font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
}

/* Flatpickr calendar must float above the fixed topbar (z-index 1030 in
   our theme), any modal backdrops, and Bootstrap dropdowns — otherwise
   the calendar pops up behind the page header and looks like nothing
   happened on click. */
.flatpickr-calendar {
    z-index: 1080 !important;
    font-size: 0.78rem !important;
    width: 280px !important;
    padding: 4px;
}

/* Reduce Flatpickr calendar internal sizing */
.flatpickr-calendar .flatpickr-day {
    height: 28px !important;
    line-height: 28px !important;
    font-size: 0.75rem !important;
    max-width: 36px;
}

.flatpickr-calendar .flatpickr-month {
    height: 32px !important;
}

.flatpickr-calendar .flatpickr-current-month {
    font-size: 0.85rem !important;
    padding: 4px 0 !important;
    height: 28px !important;
}

.flatpickr-calendar .flatpickr-weekday {
    font-size: 0.7rem !important;
    height: 24px !important;
    line-height: 24px !important;
}

.flatpickr-calendar .flatpickr-prev-month,
.flatpickr-calendar .flatpickr-next-month {
    padding: 6px !important;
}

/* Compact locale-date-filter inputs (used in ticket list, dashboard, reports) */
.locale-date-filter {
    font-size: 0.72rem !important;
    height: 26px !important;
    padding: 0.15rem 1.6rem 0.15rem 0.4rem !important;
    line-height: 1.2 !important;
    background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='%236c757d'%3E%3Cpath d='M3.5 0a.5.5 0 0 1 .5.5V1h8V.5a.5.5 0 0 1 1 0V1h1a2 2 0 0 1 2 2v11a2 2 0 0 1-2 2H2a2 2 0 0 1-2-2V3a2 2 0 0 1 2-2h1V.5a.5.5 0 0 1 .5-.5zM1 4v10a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1V4H1z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 6px center;
    background-size: 12px 12px;
}

/* Wrapper for date filter with clear button */
.date-filter-wrapper {
    position: relative;
    display: inline-block;
    width: 100%;
}

.date-filter-wrapper .date-clear-x {
    position: absolute;
    right: 22px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: #adb5bd;
    font-size: 0.85rem;
    line-height: 1;
    padding: 0 4px;
    cursor: pointer;
    z-index: 5;
    display: none;
}

.date-filter-wrapper .date-clear-x:hover {
    color: #dc3545;
}

.date-filter-wrapper input.locale-date-filter:not(:placeholder-shown) + .date-clear-x,
.date-filter-wrapper input.locale-date-filter[value]:not([value=""]) + .date-clear-x {
    display: inline-block;
}

a, .btn-link {
    color: #006bb7;
}

.btn-primary {
    color: #fff;
    background-color: #1b6ec2;
    border-color: #1861ac;
}

.btn:focus, .btn:active:focus, .btn-link.nav-link:focus, .form-control:focus, .form-check-input:focus {
  box-shadow: 0 0 0 0.1rem white, 0 0 0 0.25rem #258cfb;
}

.content {
    padding-top: 0.4rem;
}

h1:focus {
    outline: none;
}

.valid.modified:not([type=checkbox]) {
    outline: 1px solid #26b050;
}

.invalid {
    outline: 1px solid #e50000;
}

.validation-message {
    color: #e50000;
}

.blazor-error-boundary {
    background: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTYiIGhlaWdodD0iNDkiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIG92ZXJmbG93PSJoaWRkZW4iPjxkZWZzPjxjbGlwUGF0aCBpZD0iY2xpcDAiPjxyZWN0IHg9IjIzNSIgeT0iNTEiIHdpZHRoPSI1NiIgaGVpZ2h0PSI0OSIvPjwvY2xpcFBhdGg+PC9kZWZzPjxnIGNsaXAtcGF0aD0idXJsKCNjbGlwMCkiIHRyYW5zZm9ybT0idHJhbnNsYXRlKC0yMzUgLTUxKSI+PHBhdGggZD0iTTI2My41MDYgNTFDMjY0LjcxNyA1MSAyNjUuODEzIDUxLjQ4MzcgMjY2LjYwNiA1Mi4yNjU4TDI2Ny4wNTIgNTIuNzk4NyAyNjcuNTM5IDUzLjYyODMgMjkwLjE4NSA5Mi4xODMx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GRkU1MDAiIGZpbGwtcnVsZT0iZXZlbm9kZCIvPjwvZz48L3N2Zz4=) no-repeat 1rem/1.8rem, #b32121;
    padding: 1rem 1rem 1rem 3.7rem;
    color: white;
}

    .blazor-error-boundary::after {
        content: "An error has occurred."
    }

.darker-border-checkbox.form-check-input {
    border-color: #929292;
}

.form-floating > .form-control-plaintext::placeholder, .form-floating > .form-control::placeholder {
    color: var(--bs-secondary-color);
    text-align: end;
}

.form-floating > .form-control-plaintext:focus::placeholder, .form-floating > .form-control:focus::placeholder {
    text-align: start;
}

/* =========================================================================
   Sidebar collapsed-rail state.
   Driven by `html.sidebar-collapsed`, which an inline <head> script in
   App.razor applies synchronously from localStorage BEFORE first paint.
   This avoids the flash that previously occurred when the per-checkbox
   state was reset by Blazor Web App's enhanced-navigation DOM swaps.
   These rules live in app.css (not the scoped MainLayout.razor.css) so
   they target <html> reliably without the per-component [b-xxx] scope
   attribute Blazor adds to scoped selectors.
   ========================================================================= */
@media (min-width: 641px) {
    /* Pin the collapsed rail to the viewport so it cannot slide horizontally
       when the page has any horizontal overflow. `position: fixed` removes
       it from the flex flow, so reserve the same width as padding-left on
       `.page` (see rule below) to prevent the main content from sliding
       underneath the rail. */
    html.sidebar-collapsed .sidebar {
        width: 48px !important;
        min-width: 48px !important;
        max-width: 48px !important;
        flex: 0 0 48px !important;
        position: fixed !important;
        top: 44px !important;
        left: 0 !important;
        bottom: 0 !important;
        height: calc(100vh - 44px) !important;
        z-index: 1020;
        /* `overflow: visible` so the floating hover chip (positioned
           absolutely past `left: 100%`) can escape the rail and read
           naturally over the page content. The vertical scroll is
           handled by `.nav-scrollable` below — the sidebar itself
           never needs to scroll, only its inner nav list. */
        overflow: visible !important;
    }
    /* Reserve the rail's footprint so main content doesn't reflow under it. */
    html.sidebar-collapsed .page {
        padding-left: 48px;
    }
    /* Both axes must use `overflow: visible` together \u2014 if either axis is
       `auto` or `scroll`, browsers silently force the other to behave the
       same (CSS "ink overflow" rule), which clips the floating hover-chip
       and produces the flickering "label appears for some menus, not
       others" bug we saw earlier. The rail's nav list is short enough on
       a real screen that vertical scrolling here is unnecessary; if it
       ever overflows the viewport, the body scroll picks it up. */
    html.sidebar-collapsed .sidebar .nav-scrollable {
        overflow: visible !important;
        scrollbar-width: none !important;
    }
    html.sidebar-collapsed .sidebar .nav-scrollable::-webkit-scrollbar {
        width: 0 !important;
        height: 0 !important;
    }
    /* Strip Bootstrap nav-item gutters so the link can fully center inside
       the 48px rail. `position: relative` is required for the floating
       hover-chip below to anchor to this row. */
    html.sidebar-collapsed .sidebar .nav-item {
        padding-left: 0 !important;
        padding-right: 0 !important;
        margin-left: 0 !important;
        margin-right: 0 !important;
        width: 48px !important;
        max-width: 48px !important;
        display: flex;
        justify-content: center;
        position: relative;
    }
    /* Rail nav-link: icon-only, centered. The label that used to sit
       UNDER the icon is now a hover-only floating chip (rules below) so
       the rail at rest is purely glyphs. */
    html.sidebar-collapsed .sidebar .nav-link {
        flex-direction: row !important;
        justify-content: center !important;
        align-items: center !important;
        gap: 0 !important;
        padding: 0 !important;
        height: 2.6rem !important;
        min-height: 2.6rem;
        width: 48px !important;
        max-width: 48px !important;
        text-align: center;
        line-height: 1.05;
        /* `overflow: visible` lets the chip leak out of the link box. */
        overflow: visible;
        position: relative;
    }
    /* Force the icon to a fixed-width centered box so font-awesome glyphs
       of differing intrinsic widths all sit on the same vertical axis. */
    html.sidebar-collapsed .sidebar .nav-link > i,
    html.sidebar-collapsed .sidebar .nav-link .nav-icon {
        font-size: 1rem !important;
        width: 1.25rem !important;
        text-align: center !important;
        margin: 0 auto !important;
        display: inline-block !important;
        line-height: 1 !important;
    }
    /* Floating hover-chip: at rest the link's <span> is hidden; on hover
       (or keyboard focus) it slides out to the right of the rail as a
       dark tooltip-style chip. `position: absolute` + `left: 100%` parks
       it just past the rail edge; `z-index: 1030` keeps it above the
       content area. */
    html.sidebar-collapsed .sidebar .nav-link > span {
        position: absolute !important;
        left: 100% !important;
        top: 50% !important;
        transform: translateY(-50%) translateX(8px) !important;
        margin: 0 !important;
        padding: 4px 10px !important;
        width: auto !important;
        max-width: none !important;
        background: #1f2937 !important;
        color: #ffffff !important;
        border-radius: 4px !important;
        font-size: 0.8125rem !important;
        font-weight: 500 !important;
        letter-spacing: 0 !important;
        white-space: nowrap !important;
        text-align: left !important;
        text-overflow: clip !important;
        overflow: visible !important;
        box-shadow: 0 4px 12px rgba(0,0,0,0.25) !important;
        opacity: 0;
        visibility: hidden;
        pointer-events: none;
        transition: opacity 120ms ease, transform 120ms ease;
        z-index: 1030;
    }
    html.sidebar-collapsed .sidebar .nav-link:hover > span,
    html.sidebar-collapsed .sidebar .nav-link:focus-visible > span {
        opacity: 1;
        visibility: visible;
        transform: translateY(-50%) translateX(4px) !important;
    }
    /* Section headers — hide their text but keep the spacing/divider. */
    html.sidebar-collapsed .sidebar .nav-section-header small {
        display: none !important;
    }
    html.sidebar-collapsed .sidebar .nav-section-header {
        padding-top: 0.25rem !important;
    }
    /* Active link's left accent border eats horizontal space here. */
    html.sidebar-collapsed .sidebar a.active {
        border-left: none !important;
        padding-left: 0 !important;
    }
    /* Disable the hover background/translate effect on collapsed rail items
       — the rail should feel like a static icon strip, not an interactive
       button row. The link itself is still clickable. */
    html.sidebar-collapsed .sidebar .nav-link:hover,
    html.sidebar-collapsed .sidebar .nav-link:focus,
    html.sidebar-collapsed .sidebar .nav-link:active,
    html.sidebar-collapsed .sidebar .nav-item:hover .nav-link,
    html.sidebar-collapsed .sidebar a.nav-link:hover {
        background-color: transparent !important;
        color: rgba(255,255,255,0.75) !important;
        transform: none !important;
        box-shadow: none !important;
    }
    /* Preserve the active item's appearance even on hover. */
    html.sidebar-collapsed .sidebar a.active,
    html.sidebar-collapsed .sidebar a.active:hover,
    html.sidebar-collapsed .sidebar a.active:focus {
        background-color: rgba(0, 122, 204, 0.25) !important;
        color: #ffffff !important;
    }
    /* Pinned brand strip: keep icon AND label visible even on collapsed rail.
       Stack them vertically and shrink "FAIDesk" so the 7 letters still fit
       inside the 48px rail. */
    html.sidebar-collapsed .sidebar .sidebar-brand-top,
    html.sidebar-collapsed .sidebar .sidebar-brand-bottom {
        flex-direction: column !important;
        gap: 0.1rem !important;
        padding: 0.4rem 0.15rem !important;
        min-height: 48px !important;
        line-height: 1 !important;
    }
    html.sidebar-collapsed .sidebar .sidebar-brand-text {
        font-size: 0.6rem !important;
        letter-spacing: 0.2px !important;
        line-height: 1 !important;
    }
    html.sidebar-collapsed .sidebar .sidebar-brand-icon {
        font-size: 1rem !important;
    }
    /* Flip the toggle glyph to point "out" when collapsed. The toggle now
       lives inside the sidebar's brand-top slot; the legacy topbar selector
       is kept too so external themes/tests that still target it keep working. */
    html.sidebar-collapsed .sidebar .sidebar-toggle-rail i,
    html.sidebar-collapsed .app-topbar .sidebar-toggle-btn i {
        transform: scaleX(-1);
    }
}