/*
    Expenses - the application shell.

    ============================================================================
    THE LAYOUT IS ONE FLEX COLUMN, AND THAT IS THE WHOLE IDEA
    ============================================================================
    The page is exactly the height of the viewport and never scrolls as a whole. A slim header
    and a one-line footer size themselves to their content and stay put; everything left over
    goes to .site-main, which is the only thing that scrolls.

        body          display: flex; flex-direction: column; height: 100%; overflow: hidden
        .site-header  flex: 0 0 auto      content height, never shrinks
        .site-main    flex: 1 1 auto      all remaining height
        .site-footer  flex: 0 0 auto      content height, never shrinks

    min-height: 0 ON .site-main IS LOAD-BEARING. A flex item's default min-height is auto,
    which means "at least as tall as my content". A 10,000-row grid inside it therefore makes
    .site-main 10,000 rows tall, which pushes the footer off the bottom of the screen and
    makes the whole page scroll - exactly what this layout exists to prevent. Setting
    min-height: 0 lets it be shorter than its content and scroll internally instead. Delete
    that one line and the symptom is "the footer is missing", which points nowhere near the
    cause.

    height: 100% AND NOT 100dvh - MEASURED, see CLAUDE_OVR.md. In a home-screen PWA both 100dvh
    and window.innerHeight grow past documentElement.clientHeight after load, by 47px on one
    report and 14px on another, while clientHeight stays put. The overshoot is outside the layout
    viewport, so it is clipped and shows only the canvas colour. html is height: 100%, so 100%
    here IS clientHeight. Do not "modernise" this back to a viewport unit.

    ============================================================================
    THE HEADER IS 150px ON A DESKTOP AND 48px ON A PHONE
    ============================================================================
    The desktop figure is the corporate site's two-tier header reproduced: a 50px navy utility
    strip above a 100px white bar. It is a lot of chrome for screens people keep open all day,
    and it is a deliberate trade for looking like National Beef on the machines that have the
    height to spare.

    The phone does not have it to spare - 150px is 18% of a 390x844 viewport, and this
    application is also served inside a WebView - so the 768px block collapses the two tiers
    into one 48px bar. That collapse is the reason the header is built as two wrappers rather
    than one row; see the note on .site-header-utility.

    The footer stays at roughly 28px throughout.

    ============================================================================
    THIS IS THE ONLY STYLESHEET, AND IT HAS THREE PARTS
    ============================================================================
      1. the shell and its components   (from here down)
      2. the palette                    (:root, near the bottom)
      3. the DevExtreme overrides       (last)

    TO RE-BRAND A SITE, CHANGE THE CUSTOM PROPERTIES IN PART 2 AND NOTHING ELSE. Every colour
    in the application resolves through them, including the DevExtreme overrides.

    _Layout.cshtml loads dx.common.css, then the DevExtreme theme, then this file. Part 3
    being last in the last file is what lets those overrides win without needing !important.
    Do not move them above the palette either - custom properties resolve at use time, not at
    parse time, so the order between parts 2 and 3 does not matter, but keeping the overrides
    at the end is what keeps the load-order guarantee obvious.
*/

/* ---------------------------------------------------------------------------------------
   Reset and shell
   --------------------------------------------------------------------------------------- */
*,
*::before,
*::after {
    box-sizing: border-box;
}

/*
    THE HIDDEN ATTRIBUTE HAS TO WIN, and without this it does not.

    The browser's own stylesheet says [hidden] { display: none }, but that is a plain
    attribute selector at the lowest possible origin. Any class rule in this file that sets
    display - .grid-host { display: flex }, .site-user - beats it, so an element marked hidden
    in the markup or via element.hidden = true stays visible. That is not a subtle failure: it
    is how a page ends up showing two panels that were meant to be mutually exclusive, which
    then pushes the footer off the bottom of the viewport.

    Declared once, here, rather than by remembering to pair every display rule with a
    :not([hidden]).
*/
[hidden] {
    display: none !important;
}

/*
    Open Sans, the corporate typeface, SERVED FROM THIS ORIGIN.

    www.nationalbeef.com self-hosts it too - there is no Google Fonts request anywhere on that
    site, and there is none here either. A webfont fetched from a third party is a request that
    leaves the network on every cold load, and inside the mobile WebView that is somebody's
    cellular connection.

    ONE VARIABLE FILE covers 400 through 700, which is why there is a single @font-face rather
    than three: 47 KB against the 517 KB of the static TTF the corporate theme serves. The
    latin subset only - this application is en-US.

    font-display: swap so text paints immediately in the fallback and re-renders when the file
    lands; a phone on a slow connection shows the expense report rather than nothing.

    THIRD-PARTY ASSET: Open Sans, Apache-2.0. Called out per the toolkit rule in CLAUDE.md.
*/
@font-face {
    font-family: "Open Sans";
    font-style: normal;
    font-weight: 400 700;
    font-display: swap;
    src: url("../fonts/open-sans-latin-variable.woff2") format("woff2");
}

html {
    height: 100%;
}

body {
    margin: 47px 0px 0px 0px;
    display: flex;
    flex-direction: column;
    /* 100% and not 100dvh - see the note at the top of this file. */
    height: 100%;
    /* The page itself never scrolls. Only .site-main does. */
    overflow: hidden;
    /* The fallbacks are load-bearing: a missing font file degrades, it does not break. */
    font-family: "Open Sans", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 0.875rem;
    line-height: 1.45;
    color: var(--site-text);
    background: var(--site-page);
}

/* ---------------------------------------------------------------------------------------
   Header
   --------------------------------------------------------------------------------------- */
/*
    TWO TIERS, as on www.nationalbeef.com: a navy utility strip carrying the account controls,
    above a white bar carrying the logo and the navigation.

    The header still declares flex: 0 0 auto, and .site-main still declares min-height: 0.
    Those two are what keep the footer on screen, and a header that just grew by 110px is
    exactly the pressure they exist to absorb - see the note at the top of this file.
*/
.site-header {
    flex: 0 0 auto;
    display: flex;
    flex-direction: column;
    /* Above the grid's sticky header row, which DevExtreme places at z-index 1. */
    z-index: 10;
}

/*
    The utility strip. On the corporate site this carries a phone number on the left and
    Register / Sign In on the right; here the right-hand side is the account menu, which is
    the same idea in the same place, and the left is a support line.
*/
.site-header-utility {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    min-height: 50px;
    padding: 0 0.9rem;
    background: var(--site-header-utility-bg);
    color: var(--site-white);
    font-weight: 700;
}

.site-header-support {
    display: flex;
    align-items: center;
    gap: 0.9rem;
    min-width: 0;
    /* The support line is the first thing to go when the strip is tight. */
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    font-size: 0.8125rem;
    color: rgba(255, 255, 255, 0.85);
}

/*
    The cyan hairlines dividing the support line's items, as on the corporate site.

    SCOPED TO THE SUPPORT LINE, not to the strip. Dividing the strip's own children would draw
    a rule to the left of the account menu with nothing on the other side of it, because the
    support element is empty until the business supplies something to put there.
*/
.site-header-support > * + * {
    border-left: 1px solid var(--site-accent);
    padding-left: 0.9rem;
}

/*
    The signed-out state: a plain link where the account menu sits. It needs stating, because
    everything else in this strip is a button that was already given a color and this is the
    one element that would otherwise fall back to the default link blue on navy.
*/
.site-user a {
    color: var(--site-white);
    text-decoration: none;
    font-weight: 700;
}

.site-user a:hover,
.site-user a:focus-visible {
    text-decoration: underline;
}

/*
    The main bar. White, with the logo and the navigation.

    The 3px cyan edge is a DEPARTURE from the corporate site, which has no border and no
    shadow under its header - it does not need one, because a full-bleed hero sits directly
    beneath. Here the page below is #f2f2f2, and a white bar on near-white would simply
    dissolve. Cyan as an edge is how the brand uses cyan anyway.
*/
.site-header-main {
    display: flex;
    align-items: center;
    gap: 1.25rem;
    min-height: 100px;
    padding: 0 0.9rem;
    background: var(--site-header-bg);
    color: var(--site-header-fg);
    border-bottom: 3px solid var(--site-accent);
}

.site-brand {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--site-header-fg);
    text-decoration: none;
    font-weight: 700;
    letter-spacing: 0.02em;
    white-space: nowrap;
}

/*
    THE LOGO AND THE WORDMARK ARE ALTERNATIVES, NOT A PAIR, and which one shows is decided by
    width in the 768px block below.

    The corporate logo is a near-black wordmark (#231F20) with a cyan mark. It reads on the
    white desktop bar and would be all but invisible on the navy mobile one, so the phone gets
    the text wordmark instead. Do not "fix" this by filtering the SVG white - ask Marketing
    for a knockout variant if the logo is wanted on navy.
*/
.site-brand img {
    height: 44px;
    width: auto;
    display: block;
}

.site-brand .site-brand-text {
    font-size: 1rem;
}

/* Below 768px the two swap - see the mobile block. */
.site-brand .site-brand-text {
    display: none;
}

/* An optional second line beside the brand, for a site that wants one. */
.site-brand .site-brand-sub {
    font-weight: 400;
    opacity: 0.75;
    font-size: 0.8125rem;
}

.site-nav {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    flex: 1 1 auto;
    min-width: 0;
    /*
        The nav can outgrow a narrow window. Scrolling it horizontally keeps the header one
        line tall; letting it wrap would silently double the header's height and eat the
        space the grid needs.
    */
    overflow-x: auto;
    scrollbar-width: none;
}

.site-nav::-webkit-scrollbar {
    display: none;
}

/*
    Nav links carry the corporate site's treatment: bold, and marked by an UNDERLINE rather
    than a filled pill. The pill this replaced was white-on-primary, which on a white bar
    would have put a navy block behind every current link.

    The 3px border is always present and merely transparent, so hovering does not move the
    text by three pixels.
*/
.site-nav a {
    color: var(--site-header-fg);
    text-decoration: none;
    font-weight: 700;
    padding: 0.35rem 0.6rem;
    border-bottom: 3px solid transparent;
    white-space: nowrap;
}

.site-nav a:hover,
.site-nav a:focus-visible {
    color: var(--site-header-fg-active);
    border-bottom-color: var(--site-header-rule);
}

.site-nav a.is-current {
    color: var(--site-header-fg-active);
    border-bottom-color: var(--site-header-fg-active);
}

/*
    A nav section that holds more than one screen - Setup, Administration. The wrapper carries no
    appearance of its own; it exists so the trigger and the DevExtreme anchor stay together as one
    flex item, and so .nav-menu-items has somewhere to hide.

    No position: relative, deliberately, and for the same reason .user-menu-trigger has none: the
    menu is an overlay appended to <body>, so it needs no positioning ancestor - and giving it one
    would suggest to the next reader that something in here is positioned against it. This wrapper
    could not serve as one anyway, since .site-nav clips it.
*/
.nav-menu {
    display: flex;
    align-items: center;
}

/*
    Made to look exactly like .site-nav a above - same weight, same padding, same always-present
    transparent 3px border so hovering does not move the text. The reset properties are not
    optional: a <button> inherits neither the header's font nor its color.
*/
.nav-menu-trigger {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    background: none;
    border: none;
    border-bottom: 3px solid transparent;
    padding: 0.35rem 0.6rem;
    font: inherit;
    font-weight: 700;
    color: var(--site-header-fg);
    white-space: nowrap;
    cursor: pointer;
}

.nav-menu-trigger:hover,
.nav-menu-trigger:focus-visible {
    color: var(--site-header-fg-active);
    border-bottom-color: var(--site-header-rule);
}

.nav-menu-trigger.is-current {
    color: var(--site-header-fg-active);
    border-bottom-color: var(--site-header-fg-active);
}

/*
    The items are real anchors so the list lives in one place; site.js reads them into the menu.
    Alongside the markup's own hidden attribute, so a stylesheet that failed to load cannot flash
    a stack of bare links into the header.
*/
.nav-menu-items {
    display: none;
}

.site-user {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    white-space: nowrap;
    font-size: 0.8125rem;
}

.site-user .user-name {
    color: var(--site-white);
    font-weight: 600;
}

/*
    The user-menu trigger. A real <button> so it is focusable and operable from the keyboard, made
    to look like the plain text it replaced: font: inherit rather than a font-size, because a
    button does not inherit the parent's font at all and would otherwise come out in the UA's
    default face at its default size.

    No position: relative here on purpose. The menu is a DevExtreme overlay appended to <body>, so
    it needs no positioning ancestor - and giving it one would suggest to the next reader that
    something inside the header is being positioned against it.
*/
.user-menu-trigger {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    background: none;
    border: 1px solid transparent;
    border-radius: 3px;
    padding: 0.2rem 0.4rem;
    font: inherit;
    color: var(--site-white);
    cursor: pointer;
}

.user-menu-trigger:hover {
    background: rgba(255, 255, 255, 0.12);
}

/*
    Focus-visible rather than focus, so a pointer user who clicks the name does not get a ring
    they did not ask for while a keyboard user still gets one they need.
*/
.user-menu-trigger:focus-visible {
    outline: 2px solid var(--site-white);
    outline-offset: 1px;
}

.user-menu-caret {
    font-size: 0.625rem;
    /* Optically centres the glyph, which sits high in its em box. */
    line-height: 1;
    opacity: 0.75;
}

.site-user form {
    margin: 0;
}

.link-button {
    background: none;
    border: 1px solid rgba(255, 255, 255, 0.35);
    color: rgba(255, 255, 255, 0.85);
    font: inherit;
    padding: 0.2rem 0.55rem;
    border-radius: 3px;
    cursor: pointer;
}

.link-button:hover {
    background: rgba(255, 255, 255, 0.12);
    color: var(--site-white);
}

/* ---------------------------------------------------------------------------------------
   The bottom navigation bar - phones only

   Built by site.js from the header's own nav anchors; see renderBottomNav there for how the
   items are chosen and why they are not a second list.

   HIDDEN HERE, SHOWN BY THE NARROW-SCREEN BLOCK AT THE END OF THIS FILE. Declaring the default
   as "not shown" rather than relying on the media query to be the only rule means the element
   is inert on a desktop even before the query is consulted - and it is what lets site.js drop
   the hidden attribute unconditionally, so a window dragged narrow gets the bar without a
   reload.
   --------------------------------------------------------------------------------------- */
.site-bottom-nav {
    display: none;
}

/* ---------------------------------------------------------------------------------------
   Main
   --------------------------------------------------------------------------------------- */
.site-main {
    flex: 1 1 auto;
    /* See the header comment. Without this the footer leaves the screen. */
    min-height: 0;
    overflow: auto;
    padding: 0.75rem 0.9rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

/*
    Opt-in modifier for a page whose content should fill the height rather than scroll - the
    full-page grids. The page then manages its own internal scrolling.

    IT CHANGES THE SCROLLING AND NOTHING ELSE. The padding and the gap stay exactly as the
    default sets them, so a full-height grid sits in the same margin as the home page's tiles
    and every screen lines up down the left edge. Zeroing them here as well is what used to
    make these pages run edge-to-edge while the home page did not - the height behaviour and
    the page margin are separate concerns, and only the first one is what "flush" means.

    The 768px block below re-tightens .site-main's padding for a phone, and that now reaches
    these pages too, which is the point.
*/
.site-main.is-flush {
    overflow: hidden;
}

/*
    A grid host. The DataGrid inside is configured height: "100%", and this chain of
    min-height: 0 is what lets that mean "the space left over" rather than "as tall as the
    data".
*/
.grid-host {
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

.grid-host > .dx-widget {
    flex: 1 1 auto;
    min-height: 0;
}

/*
    AND THE SAME THING ON THE OTHER AXIS.

    DevExtreme writes an inline max-width onto the grid's root element equal to the natural width
    of its columns, which shrink-wraps the grid and leaves the rest of the host empty - 729px of it
    on the user list at 1920, and 98px inside the editor popup. A .grid-host exists to be filled,
    so that cap is exactly wrong here.

    !important IS REQUIRED AND IS NOT LAZINESS. The declaration it overrides is INLINE
    (style="height: 100%; max-width: 1162px"), and the load-order guarantee described at the top of
    this file only settles stylesheet against stylesheet - no selector, however specific, outranks
    an inline style. This is the same situation as [hidden] near the top of the file, and the only
    other !important here.

    Two selectors because the host is sometimes the widget root itself (DevExtreme adds its classes
    to whatever element the grid is constructed on) and sometimes its parent.

    This makes the grid BOX fill. Whether the COLUMNS fill it is a separate question, answered per
    grid: a column left without a width absorbs the slack, and a grid whose columns are every one
    fixed-width shows empty grid behind them instead.
*/
.grid-host.dx-widget,
.grid-host > .dx-widget {
    max-width: none !important;
}

/* ---------------------------------------------------------------------------------------
   Footer
   --------------------------------------------------------------------------------------- */
.site-footer {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.25rem 0.9rem;
    background: var(--site-gray-100);
    border-top: 1px solid var(--site-border);
    color: var(--site-text-muted);
    font-size: 0.75rem;
}

.site-footer .footer-spacer {
    flex: 1 1 auto;
}

.site-footer a {
    color: var(--site-text-muted);
}

/* The deployed build, at the right-hand end after .footer-spacer. Deliberately quiet - it is
   reference material for a support call, not something to read on every page. Tabular figures
   so a version number does not jitter the footer as it changes. */
.site-footer .footer-build {
    font-variant-numeric: tabular-nums;
    opacity: 0.7;
}

/* ---------------------------------------------------------------------------------------
   Panels and forms
   --------------------------------------------------------------------------------------- */
.panel {
    background: var(--site-white);
    border: 1px solid var(--site-border);
    border-radius: var(--site-radius);
    padding: 0.75rem 0.9rem;
}

.panel > h2 {
    margin: 0 0 0.5rem;
    font-size: 0.9375rem;
    font-weight: 600;
}

/* ---------------------------------------------------------------------------------------
   Sign-in and other centered single-purpose pages
   --------------------------------------------------------------------------------------- */
.centered-page {
    flex: 1 1 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 0;
    overflow: auto;
}

.card {
    width: min(26rem, 100%);
    background: var(--site-white);
    border: 1px solid var(--site-border);
    border-top: 3px solid var(--site-accent);
    border-radius: var(--site-radius);
    padding: 1.5rem;
}

.card h1 {
    margin: 0 0 0.25rem;
    font-size: 1.125rem;
}

.card .card-subtitle {
    margin: 0 0 1.25rem;
    color: var(--site-text-muted);
    font-size: 0.8125rem;
}

/* The site name at the head of the centred account card, standing in for a logo. */
.card-brand {
    margin: 0 0 1rem;
    text-align: center;
    font-size: 1.125rem;
    font-weight: 700;
    letter-spacing: 0.01em;
    color: var(--site-primary);
}

.field {
    margin-bottom: 0.85rem;
}

.field label {
    display: block;
    margin-bottom: 0.2rem;
    font-weight: 600;
    font-size: 0.8125rem;
}

.field input[type="text"],
.field input[type="password"],
.field input[type="email"] {
    width: 100%;
    padding: 0.45rem 0.55rem;
    border: 1px solid var(--site-border);
    border-radius: 3px;
    font: inherit;
}

.field input:focus-visible {
    outline: 2px solid var(--site-primary);
    outline-offset: -1px;
}

button.primary {
    width: 100%;
    padding: 0.5rem 0.75rem;
    background: var(--site-primary);
    color: var(--site-white);
    border: none;
    border-radius: 3px;
    font: inherit;
    font-weight: 600;
    cursor: pointer;
}

button.primary:hover {
    background: var(--site-primary-dark);
}

button.primary:disabled {
    opacity: 0.6;
    cursor: default;
}

.field-error,
.validation-summary {
    color: var(--site-primary-dark);
    font-size: 0.8125rem;
}

.validation-summary:not(:empty) {
    margin-bottom: 0.85rem;
    padding: 0.5rem 0.6rem;
    background: var(--site-primary-wash);
    border-left: 3px solid var(--site-primary);
    border-radius: 3px;
}

.validation-summary ul {
    margin: 0;
    padding-left: 1.1rem;
}

.card-links {
    margin-top: 1rem;
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    font-size: 0.8125rem;
}

/*
    A card link that has to be a POST - signing out, for one - is a form and a button rather
    than an anchor, because a GET that changes state is a link any page on the internet can
    fire on the user's behalf. These two rules let that button sit beside real links without
    looking like a stray form control.
*/
.card-links form {
    margin: 0;
}

.card-links button {
    padding: 0;
    background: none;
    border: none;
    color: var(--site-primary);
    font: inherit;
    text-decoration: underline;
    cursor: pointer;
}

.card-links button:hover {
    color: var(--site-primary-dark);
}

.notice {
    padding: 0.6rem 0.75rem;
    border-radius: var(--site-radius);
    background: var(--site-gray-100);
    border-left: 3px solid var(--site-border);
}

.notice.is-warning {
    background: var(--site-warning-wash);
    border-left-color: var(--site-warning);
}

/* ---------------------------------------------------------------------------------------
   Badges, page headings and toolbars
   --------------------------------------------------------------------------------------- */
.status-badge {
    display: inline-block;
    font-size: 0.6875rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: 0.05rem 0.4rem;
    border-radius: 999px;
    background: var(--site-gray-100);
    border: 1px solid var(--site-border);
    color: var(--site-text-muted);
}

.status-badge.is-alarm {
    background: var(--site-primary-wash);
    border-color: var(--site-primary);
    color: var(--site-primary-dark);
}

.page-heading {
    flex: 0 0 auto;
    display: flex;
    align-items: baseline;
    gap: 0.75rem;
    flex-wrap: wrap;
}

/*
    THE WAY OUT OF A RECORD SCREEN, at the top of it. The report editor, the approval review and
    the accounting itemize screens all scroll as a page, and the button that leaves them is built
    by their scripts at the very bottom, below the lines grid, the receipt rail and the history
    panel. This is the same destination, reachable without scrolling.

    align-self, AND IT IS LOAD-BEARING. Its parent .expense-report-editor is a flex COLUMN, so the
    default align-items: stretch would make this anchor span the whole row - a link with an
    invisible click target the full width of the page, immediately above the title.

    NO COLOR OF ITS OWN, and that is a decision rather than an omission. This stylesheet has no
    global `a` rule - every anchor is styled by its container (.site-nav a, .site-user a,
    .site-footer a) - so a plain content link renders in the browser's default #0000EE underline.
    That is what "Forgot your password?" and "Back to home" already look like, so matching them
    keeps this link consistent with every other content link on the site. Giving this one the
    brand navy would make it the odd one out; recoloring content links is a palette sweep for all
    of them at once, not a thing to do here.

    0.8125rem matches .page-heading-note, which keeps it subordinate to the 1.0625rem h1 below -
    it is the way out, not the point of the page.
*/
.page-back {
    align-self: flex-start;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.8125rem;
}

.page-heading h1 {
    margin: 0;
    font-size: 1.0625rem;
}

.page-heading .page-heading-note {
    color: var(--site-text-muted);
    font-size: 0.8125rem;
}

/*
    The same muted note, for use OUTSIDE a .page-heading - inside the popup editors, mostly.
    It needs its own rule because the selector above is a descendant one: the class alone
    styled nothing, so a note placed outside a .page-heading rendered as ordinary body text.
*/
.editor-note {
    margin: 0 0 0.75rem;
    color: var(--site-text-muted);
    font-size: 0.8125rem;
    max-width: 70ch;
}

/*
    The button row under a form that saves itself, rather than inside a popup that has its own.
    Used by the tenant settings screen; a site adding its own settings form wants the same.
*/
.form-actions {
    display: flex;
    gap: 0.5rem;
    margin: 1rem 0 0.25rem;
}

.toolbar {
    flex: 0 0 auto;
    display: flex;
    align-items: flex-end;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.toolbar .toolbar-field {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.toolbar .toolbar-field > label {
    font-size: 0.75rem;
    color: var(--site-text-muted);
}

.toolbar .toolbar-spacer {
    flex: 1 1 auto;
}

/* Respect a user who has asked the operating system for less motion. */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }
}

/* =========================================================================================
   PART 2 - THE PALETTE

   CHANGE THESE VALUES TO RE-BRAND, AND CHANGE NOTHING ELSE. Every color in the shell and
   in the DevExtreme overrides below resolves through these properties.

   THIS IS THE NATIONAL BEEF PALETTE, taken from www.nationalbeef.com's own design tokens
   (--wp--custom--colors--*) rather than sampled from a screenshot, so the names in the
   comments below are the corporate site's names for these colors and not invented ones.

   HOW THE CYAN MAY BE USED, because this is the one that will get somebody in trouble.
   #009dd9 on white measures 3.08:1, and white on #009dd9 the same - both below the 4.5:1
   that normal text needs. It is an EDGE AND SURFACE color: rules, underlines, and button
   faces carrying BLACK text (6.82:1). Never small text on white, never a white-on-cyan
   button. That is also exactly how the corporate site uses it.

   Component rules read as "primary" and "accent" rather than as color names, so a later
   rebrand does not leave the stylesheet talking about navy.
   ========================================================================================= */
:root {
    /* ---- Primary: navigation, links, buttons, selection ---- */
    --site-primary: #002d72;        /* their "midnight" / accent-1 / button-primary */
    --site-primary-dark: #001639;   /* their "darkblue" - the button hover */
    --site-primary-light: #33578e;  /* their "midnight-80" */
    /* DERIVED, not a corporate token: they have no light navy. Kept for washes and hovers. */
    --site-primary-wash: #e9eef6;

    /*
        The accent, used only for the 3px edge under the header and along the top of the
        account card, and for the selected tab's underline. Kept distinct from the primary so
        those edges register as deliberate rather than as a slightly-off border.
    */
    --site-accent: #009dd9;         /* their "cerulean" / accent-2 */

    /*
        DERIVED, not a corporate token: the cerulean darkened about a fifth, and it exists for
        exactly one reason - it is the lightest shade of that cyan that can carry WHITE TEXT.

        White on --site-accent is 3.08:1, and against a 4.5:1 requirement that is not a
        rounding argument: the label visibly hazes. This is 4.70:1. Anything lighter drops
        under the line - 18% darker is already 4.39:1 - so if this needs adjusting, adjust it
        DOWNWARD in lightness, never up.

        Used for surfaces that are filled with the accent and carry text on top. Where the
        accent is only an EDGE - the header rule, the selected tab - keep using --site-accent,
        because a 3px line has no contrast requirement to meet.
    */
    --site-accent-deep: #009dd9;

    /*
        ---- The header ----

        TWO BARS, NOT ONE, matching the corporate site: a navy utility strip above a white
        bar carrying the logo and the navigation.

        ALL FIVE OF THESE FLIP TOGETHER in the 768px block, where the two bars collapse into a
        single NAVY one. That is why the nav rules below name these rather than naming black
        and navy directly: on the mobile bar, navy text on navy would be invisible and the
        cyan underline would be nearly so. Change one of them and change the set.
    */
    --site-header-utility-bg: #002d72;
    --site-header-bg: #ffffff;
    --site-header-fg: #000000;
    --site-header-fg-active: #002d72;
    --site-header-rule: #009dd9;

    /* ---- Neutrals ---- */
    --site-white: #ffffff;
    --site-text: #000000;           /* their "heading" / "link" */
    --site-text-muted: #666666;     /* their "grey-50" - 5.74:1 on white */
    --site-page: #f2f2f2;           /* their "grey-10" */
    --site-gray-100: #e5e5e5;       /* their "grey-20" */
    --site-border: #dadada;         /* their "nav-separator" */

    /*
        Status colors. Amber for "needs a look", red for "something is wrong". Neither is
        derived from the primary, deliberately: a warning that shares the chrome's color
        reads as chrome and gets ignored.

        THE AMBER IS NOT A CORPORATE COLOR AND THAT IS THE POINT. National Beef's palette has
        no warning color at all - its other colors are sub-brand reds and greens, not status
        - so branding this one would have meant expressing "needs a look" in navy or cyan,
        which is the chrome. Against navy chrome the amber reads more clearly, not less. The
        danger red IS theirs: "error", 6.53:1 on white.
    */
    --site-warning: #d98a00;
    --site-warning-text: #8a6200;
    --site-warning-wash: #fdf5e0;
    --site-danger: #bf0000;
    --site-danger-wash: #fdeceb;

    /*
        The completed state - a posted report, a coded line. Green for the same reason the
        amber is amber: it is a status, and National Beef has no status green either. These
        were hard-coded further down the file until the re-brand; they are here now because
        the promise at the top of this block is that EVERY color resolves through it, and a
        stylesheet that says so while hiding three greens in the badge rules is lying.
    */
    --site-success: #2f6b47;
    --site-success-border: #7fae91;
    --site-success-wash: #e8f3ec;

    /* The zebra stripe on a data grid. Barely off white on purpose. */
    --site-row-alt: #fafbfc;

    --site-radius: 4px;
}

/* Errors are red, not primary-coloured - see the note on the status colours above. */
.status-badge.is-alarm {
    background: var(--site-danger-wash);
    border-color: var(--site-danger);
    color: var(--site-danger);
}

.validation-summary:not(:empty) {
    background: var(--site-danger-wash);
    border-left-color: var(--site-danger);
}

.field-error,
.validation-summary {
    color: var(--site-danger);
}

/* =========================================================================================
   PART 3 - DEVEXTREME OVERRIDES

   A SHORT LIST ON PURPOSE. Fighting a component library's stylesheet selector by selector is
   a maintenance burden that comes due at every upgrade, so only the places where the stock
   theme's blue would sit next to the site's own primary and look like a mistake are touched:
   the accent, the grid header row, and selection. Everything else keeps the stock light
   compact theme, which is coherent on its own.

   These are last in the last stylesheet, which is why none of them needs !important except
   where noted - DevExtreme sets those particular properties on a more specific selector.
   ========================================================================================= */

/*
    dxMenu lays its items out inline by default, which is wrong for the vertical context menu
    the header uses - the three items ended up on one line.
*/
.dx-menu-base .dx-menu-item {
    display: block !important;
    width: auto !important;
}

/*
    DevExtreme ships its own font stack and does not inherit, so this has to restate the body's
    stack rather than say "inherit" - and it is the rule that matters most for the typeface,
    because the grids, buttons and popups it covers are most of what is on screen. Change the
    body font-family and change this with it, or the shell and the widgets will disagree.
*/
.dx-theme-generic-typography,
.dx-widget {
    font-family: "Open Sans", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

/* Grid header row: tinted so the column headers read as part of the site chrome. */
.dx-datagrid .dx-datagrid-headers {
    background-color: var(--site-primary-wash);
    color: var(--site-primary-dark);
    font-weight: 600;
}

/*
    A SECTION HEADING RENDERED INSIDE ITS GRID'S TOOLBAR - see Expenses.gridHeadingToolbar.

    Matched to .panel > h2 deliberately, down to the weight: a heading in here and a heading in the
    markup above a toolbar-less grid have to be indistinguishable, or moving one into a toolbar
    would trade a spacing inconsistency for a typographic one.
*/
.grid-toolbar-heading {
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--site-primary-dark);
    white-space: nowrap;
}

/* This is intended to make the notes feel vertically centered with their heading */
.dx-datagrid .dx-datagrid-header-panel .dx-toolbar-before .dx-toolbar-item-content:has(.panel-heading-note) {
    padding-top: 0.25em;
}

/*
    THE HEADING ROW STAYS ONE LINE, AND THAT IS NOT A PREFERENCE.

    dx-toolbar pins its items container to a fixed height, so a heading long enough to wrap does
    not make the band taller - the second line is drawn straight over the column headers below it.
    Seen with "Expenses · 424.00 claimed · 424.00 approved" at phone width, where "approved"
    landed on top of the header row.

    height: auto on the container is NOT the fix. The before/after sections resolve their own
    height against it, so releasing it collapses the toolbar to nothing and the heading disappears
    entirely - measured, on 24.2.5. Keeping the row to one line and letting the note truncate is
    what degrades cleanly: at 360px, the narrowest phone worth designing for, the whole thing still
    fits; below that the note ellipses away and the heading itself never does.
*/
.dx-datagrid .dx-datagrid-header-panel .dx-toolbar-before {
    min-width: 0;
    max-width: 100%;
}

.dx-datagrid .dx-datagrid-header-panel .dx-toolbar-before .dx-toolbar-item-content {
    display: flex;
    align-items: center;
    min-width: 0;
}

/* The heading's trailing note - a running total, usually - gives way before the heading does. */
.dx-datagrid .dx-datagrid-header-panel .panel-heading-note {
    min-width: 0;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.dx-datagrid .dx-row-alt > td {
    background-color: var(--site-row-alt);
}

.dx-datagrid-total-footer>.dx-datagrid-content .dx-row>td {
    padding-top: 5px !important;
    padding-bottom: 5px !important;
}

.dx-datagrid-rowsview .dx-selection > td,
.dx-datagrid-rowsview .dx-selection:hover > td {
    background-color: var(--site-primary-wash) !important;
    color: var(--site-text) !important;
}

.dx-datagrid-rowsview .dx-row-focused > td {
    background-color: var(--site-primary) !important;
    color: var(--site-white) !important;
}

/*
    A grid whose rows navigate on click. The pointer is the only signal they do - three screens
    open a record by clicking anywhere on the row (the report list, the approval queue and the
    accounting queue) and each looked like plain text until it was tried.

    OPTED INTO PER GRID, via elementAttr, rather than applied to every .dx-data-row: most grids in
    this application are edited in place or through a popup button, and a pointer over a cell that
    does nothing is the same lie in the other direction.

    The action column keeps its own cursor - DevExtreme's buttons set theirs - so the trash icon on
    the report list is unaffected.
*/
.grid-rows-clickable .dx-datagrid-rowsview .dx-data-row {
    cursor: pointer;
}

/* Primary buttons and the focused-input outline pick up the site's primary. */
.dx-button-mode-contained.dx-button-default {
    background-color: var(--site-primary);
    border-color: var(--site-primary);
}

.dx-button-mode-contained.dx-button-default.dx-state-hover {
    background-color: var(--site-primary-dark);
    border-color: var(--site-primary-dark);
}

.dx-texteditor.dx-state-focused.dx-editor-outlined {
    border-color: var(--site-primary);
}

.dx-checkbox-checked .dx-checkbox-icon {
    background-color: var(--site-primary);
    border-color: var(--site-primary);
}

.dx-tabpanel .dx-tabs .dx-tab-selected {
    color: var(--site-primary);
    font-weight: 600;
}

/*
    THE SELECTED TAB'S ::after IS NOT AN UNDERLINE IN THIS THEME. In dx.light it is a
    full-area element that draws the tab's border box on all four sides, so giving it a
    background-color filled the whole tab with the accent and painted straight over the
    label - the tab read as an empty coloured block. Colour its bottom edge instead and leave
    the fill alone.
*/
.dx-tabs-wrapper .dx-tab-selected::after {
    background-color: transparent;
    border-block-end: 3px solid var(--site-accent);
}

/*
    Breathing room between the tab strip and whatever the tab contains.

    dxTabPanel butts its content directly against the tabs, so the setup grid's toolbar - its
    add button and search box - sat flush under the tab labels with the selected tab's 3px
    underline touching it. Padding on the multiview item rather than a margin on the grid, so
    it applies to every tab including "Accrual accounts", which holds a form and not a grid.

    The grid still fills the height beneath it: .dx-multiview-item is the flex/height chain
    the grids' height: 100% resolves against, and padding does not break that the way an extra
    wrapper would.
*/
.dx-tabpanel .dx-multiview-item > * {
    padding-top: 5px;
}

/*
    The header's user menu.

    It renders as stock light-compact - a white surface with dark text - because the widget is
    appended to <body> and inherits nothing from the dark header. That is the right default and
    only the accent needs saying: a hovered or focused item picks up the primary wash rather
    than the theme's grey, so the menu reads as part of this site.
*/
.dx-context-menu .dx-menu-item {
    margin: 7px;
}

.dx-context-menu .dx-menu-item.dx-state-hover,
.dx-context-menu .dx-menu-item.dx-state-focused {
    background-color: var(--site-primary-wash);
    color: var(--site-primary);
}

.dx-context-menu .dx-menu-item .dx-icon {
    color: var(--site-primary);
}

/*
    Row shading driven by DATA rather than by widget state, for a grid that wants to flag
    rows needing attention. Applied by a grid's own onCellPrepared / cellTemplate hook, so the
    meaning stays in the JavaScript and only the paint is here. Nothing in the template uses
    these yet; they are the pattern to follow rather than dead weight to delete.
*/
.dx-datagrid-rowsview .row-is-warning > td {
    background-color: var(--site-warning-wash);
}

.dx-datagrid-rowsview .row-is-alarm > td {
    background-color: var(--site-danger-wash);
}

/*
    Popup title bars in the brand accent, so a window that opens over the application looks like
    it belongs to it rather than to the component library.

    ONE RULE FOR EVERY POPUP. dxPopup, the grids' popup edit mode and DevExpress.ui.dialog all
    render the same .dx-popup-title element, so the twenty-odd titled surfaces here stay in step
    without any of them opting in and without this having to know they exist.

    THE BAR IS --site-accent-deep AND NOT --site-accent, WHICH IS THE WHOLE POINT OF THAT TOKEN.
    White on the plain cerulean is 3.08:1 against a 4.5:1 requirement, and it does not merely
    fail on paper - the label hazes. The deepened shade is 4.70:1 and is the lightest cyan that
    clears the line, so this reads as the brand blue while staying legible.

    So do not "simplify" this to var(--site-accent): that is the edge colour, for the 3px rules
    that carry no text. This is a filled surface with a label on it, which is a different job.
*/
.dx-popup-title {
    background-color: var(--site-accent-deep);
    color: var(--site-white);
    /* The stock 1px #ddd rule reads as a seam once the bar is filled. */
    border-bottom: none;
}

.dx-popup-title .dx-toolbar-label {
    color: var(--site-white);
    font-weight: 600;
}

/* The close button inherits nothing - the theme colours the glyph itself. */
.dx-popup-title .dx-closebutton .dx-icon {
    color: var(--site-white);
}

/* =======================================================================================
   EXPENSE REPORTING

   Everything below is this site's own, added on top of the shell above. It is at the end of
   the file for the same reason site.css is loaded last: these rules override DevExtreme's
   theme, and being last is what lets them do so without !important.
   ======================================================================================= */

/* ---------------------------------------------------------------------------------------
   Status badges

   .status-badge and .status-badge.is-alarm come from the shell. Two more here: a completed
   state and a draft. Colour is not the only signal on any of them - the badge always carries
   its own text - because a status told only in colour is not a status to somebody who cannot
   distinguish the two.
   --------------------------------------------------------------------------------------- */
.status-badge.is-complete {
    background: var(--site-success-wash);
    border-color: var(--site-success-border);
    color: var(--site-success);
}

.status-badge.is-draft {
    background: var(--site-warning-wash);
    border-color: var(--site-warning);
    color: var(--site-warning-text);
}

/* ---------------------------------------------------------------------------------------
   A ledger row that has not happened.

   The general ledger grid shows what posting WOULD record beside what is actually recorded.
   Same rule as the badges above: colour is not the only signal - every one of these rows
   also says "(unposted)" in its Type cell, and the wash is only there to keep the eye from
   reading a projection as a fact while scanning.
   --------------------------------------------------------------------------------------- */
.dx-datagrid .dx-row.is-unposted > td {
    background: var(--site-gray-100);
    color: var(--site-text-muted);
    font-style: italic;
}

/* ---------------------------------------------------------------------------------------
   The net-by-account block under the ledger - where each account ends up.

   Nil shows as an em dash and is muted, which is the accounting convention and also the
   right emphasis: a clearing account netting to nil is the expected outcome, and a column
   that shouted every time nothing was wrong would stop being read by the time something
   was. The amounts that are NOT nil are what the eye should land on.
   --------------------------------------------------------------------------------------- */
.ledger-net {
    font-variant-numeric: tabular-nums;
}

.ledger-net.is-balanced {
    color: var(--site-text-muted);
}

/* ---------------------------------------------------------------------------------------
   The landing page tiles
   --------------------------------------------------------------------------------------- */
.tile-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr));
    gap: 0.75rem;
    margin-top: 0.75rem;
}

.tile {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    padding: 0.9rem 1rem;
    background: var(--site-white);
    border: 1px solid var(--site-border);
    border-top: 3px solid var(--site-accent);
    border-radius: var(--site-radius);
    text-decoration: none;
    color: inherit;
    /* Comfortably past the 44px minimum for a touch target. */
    min-height: 5.5rem;
}

.tile:hover,
.tile:focus-visible {
    border-color: var(--site-primary);
    border-top-color: var(--site-primary);
}

.tile-is-action {
    border-top-color: var(--site-primary);
}

.tile-is-action[data-new-report=true] {
    border-top-color: var(--site-warning);
}

.tile-title {
    font-weight: 600;
    color: var(--site-primary-dark);
}

.tile-count {
    font-size: 1.75rem;
    line-height: 1.1;
    font-weight: 600;
    color: var(--site-primary);
    /* Reserves the line so a tile does not jump when its count arrives. */
    min-height: 1.9rem;
}

.tile-note {
    font-size: 0.8125rem;
    color: var(--site-text-muted);
}

/* ---------------------------------------------------------------------------------------
   The report editor
   --------------------------------------------------------------------------------------- */
.expense-report-editor {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.panel-heading-note {
    font-weight: 400;
    font-size: 0.8125rem;
    color: var(--site-text-muted);
    margin-left: 0.5rem;
}

.problem-list {
    margin: 0;
    padding-left: 1.1rem;
    color: var(--site-warning-text);
}

.problem-list li {
    margin-bottom: 0.25rem;
}

/*
    The header definition list. Two columns on a wide screen, stacked on a narrow one - a
    label above its value reads better in the width of a phone than a label squeezed beside it.
*/
.detail-list {
    display: grid;
    grid-template-columns: max-content 1fr;
    gap: 0.3rem 1rem;
    margin: 0;
}

.detail-list dt {
    color: var(--site-text-muted);
    font-size: 0.8125rem;
}

.detail-list dd {
    margin: 0;
}

/* The expanded row under a line: its receipts, and accounting's coding. */
.line-detail {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    padding: 0.4rem 0.2rem;
}

.line-detail-heading {
    margin: 0;
    font-size: 0.875rem;
    color: var(--site-primary-dark);
}

.line-detail-note {
    margin: 0;
    font-size: 0.8125rem;
    color: var(--site-text-muted);
}

.line-detail-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

/*
    A PRIMARY BUTTON DISABLED BECAUSE SOMETHING IS WRONG, which is a different state from one
    disabled because it does not apply yet - the first is asking for action and should not look
    like the second. Used on Approve and post while any line is out of balance.

    THE OPACITY OVERRIDE IS LOAD-BEARING: DevExtreme fades a disabled widget to .5, which turns
    any pastel into a smudge. The tooltip lives on the wrapper rather than the button for the
    matching reason - .dx-state-disabled sets pointer-events: none, so a title on the button
    itself is never hovered. See renderActions.
*/
.post-action.is-blocked .dx-button.dx-state-disabled {
    opacity: 1;
    background-color: var(--site-danger);
    border-color: var(--site-danger-wash);
    color: var(--site-danger-wash);
}

.post-action.is-blocked {
    cursor: not-allowed;
}

/* ---------------------------------------------------------------------------------------
   Itemization

   One receipt is routinely several expenses, so a line carries a row per part. Two places
   show them: the EDITOR, a grid inside the line popup, and the SUMMARY, read-only, in the
   expanded row beside the receipts.
   --------------------------------------------------------------------------------------- */
.itemization-editor {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.itemization-heading {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--site-primary-dark);
}

/* ---------------------------------------------------------------------------------------
   Receipts

   A HORIZONTALLY SCROLLING RAIL rather than a wrapping grid. On a phone a wrapping grid of
   thumbnails pushes everything below it off the screen; a rail stays one row tall however
   many receipts there are, and swiping it sideways is a gesture people already know.
   --------------------------------------------------------------------------------------- */
/*
    THE PADDING IS NOT DECORATION - IT IS WHAT KEEPS THE "×" WHOLE.

    overflow-x: auto forces the OTHER axis to compute to auto as well, so this is a scroll container
    in both directions and clips anything outside its content box. The delete badge is deliberately
    hung 0.4rem above and 0.4rem to the right of its thumbnail, which is exactly outside it: with no
    padding here, the top of the circle is sliced off.

    Top and right are that overhang plus enough room for the badge's focus ring, which is drawn
    outside it again. Bottom leaves room for the horizontal scrollbar. Remove any of the three and
    the badge, its ring, or the scrollbar lands on something.
*/
.receipt-rail {
    display: flex;
    gap: 0.5rem;
    overflow-x: auto;
    padding-top: 0.75rem;
    padding-right: 0.75rem;
    padding-bottom: 0.25rem;
    /* Snaps each thumbnail to the left edge as the rail is swiped. */
    scroll-snap-type: x proximity;
}

.receipt-rail-empty {
    color: var(--site-text-muted);
    font-size: 0.8125rem;
}

/*
    ONE NUMBER FOR THE PICTURE, and the item around it sizes to whatever it holds. The image stays
    square at --receipt-thumb-size; the figure grows past it when there is an "Attach to…" button
    underneath, which does not fit in the width of a thumbnail at button size. The rail already
    scrolls sideways, so a wider item costs nothing but its own space.
*/
.receipt-thumb {
    --receipt-thumb-size: 6.5rem;
    position: relative;
    flex: 0 0 auto;
    width: max-content;
    min-width: var(--receipt-thumb-size);
    margin: 0;
    scroll-snap-align: start;
}

.receipt-thumb a {
    display: block;
    width: var(--receipt-thumb-size);
    height: var(--receipt-thumb-size);
    border: 1px solid var(--site-border);
    border-radius: var(--site-radius);
    overflow: hidden;
    background: var(--site-gray-100);
}

.receipt-thumb img {
    width: 100%;
    height: 100%;
    /* Fills the square and crops rather than letterboxing - a receipt is usually portrait. */
    object-fit: cover;
    display: block;
}

.receipt-thumb-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--site-text-muted);
}

.receipt-thumb figcaption {
    /* Held to the picture's width, which is what gives the ellipsis below something to clip to. */
    width: var(--receipt-thumb-size);
    font-size: 0.6875rem;
    color: var(--site-text-muted);
    /* One line, clipped: a file name from a phone is long and uninformative past the start. */
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-top: 0.15rem;
}

/*
    PINNED FROM THE LEFT, not the right. The figure is now as wide as its widest child rather than
    as wide as the picture, so a right-anchored "×" would drift off the corner it belongs to and
    hang in the space beside the image. Measured from the image's own edge instead, it stays put
    however wide the item gets.
*/
.receipt-thumb-remove {
    position: absolute;
    top: -0.4rem;
    left: calc(var(--receipt-thumb-size) - 1.1rem);
    width: 1.5rem;
    height: 1.5rem;
    border-radius: 999px;
    border: 1px solid var(--site-border);
    background: var(--site-white);
    color: var(--site-danger);
    font-size: 1rem;
    line-height: 1;
    cursor: pointer;
}

.receipt-thumb-remove:hover,
.receipt-thumb-remove:focus-visible {
    background: var(--site-danger-wash);
}

/*
    The two "attach" controls, made to read as the same kind of thing as "Photograph a receipt" and
    "Add a receipt to this line" - which is what they are, and which is not what a small text link
    beside a solid button looks like.

    THE COLOUR IS NOT HERE. Both are dxButtons with type "default", so they are already painted by
    the .dx-button-mode-contained.dx-button-default rule further up this file. This sets only the
    three things that make .receipt-capture-button read as a button and that the widget would
    otherwise decide for itself.
*/
.receipt-attach-button .dx-button {
    /* 44px minimum touch target, matching the capture button beside it. */
    min-height: 2.75rem;
    border-radius: var(--site-radius);
}

.receipt-attach-button .dx-button .dx-button-text {
    font-size: 0.875rem;
    /* Sentence case, as the label beside it is - some themes upper-case button text. */
    text-transform: none;
}

/* "Attach to…" fills its rail item, which has sized itself to fit the button. */
.receipt-thumb-assign.is-attach {
    margin-top: 0.25rem;
}

.receipt-thumb-assign.is-attach .dx-button {
    width: 100%;
}

/*
    "Detach" stays small and quiet. It is narrower than the thumbnail, so an attached receipt's
    rail item is still exactly as wide as its picture.
*/
.receipt-thumb-assign.is-detach {
    width: var(--receipt-thumb-size);
}

.receipt-thumb-assign.is-detach .dx-button {
    width: 100%;
}

.receipt-thumb-assign.is-detach .dx-button .dx-button-text {
    font-size: 0.6875rem;
    text-transform: none;
}

/*
    The capture control.

    The file input is visually hidden and driven by its label, which is what lets it be styled
    as a button. HIDDEN WITH clip AND NOT display:none: a display:none input is removed from
    the accessibility tree and, in some browsers, can no longer be activated by its own label -
    which would break the one control this screen exists for.
*/
.receipt-capture {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    flex-wrap: wrap;
    margin-top: 0.5rem;
}

.receipt-input {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.receipt-capture-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    /* 44px minimum touch target - this is the control a phone user reaches for most. */
    min-height: 2.75rem;
    padding: 0 1rem;
    background: var(--site-primary);
    color: var(--site-white);
    border-radius: var(--site-radius);
    font-size: 0.875rem;
    cursor: pointer;
}

.receipt-capture-button:hover {
    background: var(--site-primary-dark);
}

/*
    "Choose a file", beside "Photograph a receipt".

    SECONDARY AND NOT A SECOND SOLID BUTTON. Two navy buttons side by side read as a choice between
    equals, and this is not one: on a phone - the device this pair exists for - photographing the
    receipt in front of you is still the common case, and browsing to a file you already have is the
    other one. The border keeps it a button rather than demoting it to a link.

    The min-height, padding and radius are inherited from the rule above, so the 44px touch target
    holds for both.
*/
.receipt-capture-button.is-secondary {
    background: var(--site-white);
    color: var(--site-primary);
    box-shadow: inset 0 0 0 1px var(--site-primary);
}

.receipt-capture-button.is-secondary:hover {
    background: var(--site-primary-wash);
}

/* Keyboard focus lands on the INPUT, so the ring has to be drawn on its sibling label. */
.receipt-input:focus-visible + .receipt-capture-button {
    outline: 2px solid var(--site-primary-dark);
    outline-offset: 2px;
}

.receipt-capture-status {
    font-size: 0.8125rem;
    color: var(--site-text-muted);
}

/* ---------------------------------------------------------------------------------------
   Straightening a photographed receipt

   The confirm-and-adjust step from receipt-perspective-ui.js. The photograph is an <img> and
   the quad is painted on a canvas over it, so dragging a corner repaints a few hundred pixels
   instead of a twelve-megapixel bitmap.
   --------------------------------------------------------------------------------------- */
.receipt-correct {
    /* 44px. The same touch target as .receipt-capture-button, and the reason the handle is a
       real button rather than something hit-tested against the canvas. */
    --receipt-handle-target: 2.75rem;
    --receipt-stage-inset: 1.5rem;
    --receipt-loupe-size: 7rem;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    height: 100%;
}

.receipt-correct-note {
    margin: 0;
    font-size: 0.875rem;
    color: var(--site-text-muted);
}

.receipt-correct-note.is-warning {
    color: var(--site-warning-text);
    font-weight: 600;
}

.receipt-correct-stage {
    position: relative;
    flex: 1;
    min-height: 12rem;
    overflow: hidden;
    border-radius: var(--site-radius);
    background: var(--site-row-alt);

    /* The inset keeps a handle whole when its corner sits on the edge of the photograph. */
    padding: var(--receipt-stage-inset);

    /*
        CSS, NOT preventDefault. A non-passive touch listener still loses the first frames of a
        gesture to the compositor before it can cancel it; touch-action never lets the scroll or
        the pinch begin. On the stage only - the note and the toolbar must stay reachable.
    */
    touch-action: none;
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
}

.receipt-correct-photo,
.receipt-correct-preview {
    position: absolute;
    inset: var(--receipt-stage-inset);
    width: calc(100% - var(--receipt-stage-inset) * 2);
    height: calc(100% - var(--receipt-stage-inset) * 2);
    object-fit: contain;
    pointer-events: none;
}

.receipt-correct-preview {
    display: flex;
    align-items: center;
    justify-content: center;
}

.receipt-correct-preview-canvas {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    box-shadow: 0 0 0 1px var(--site-border);
}

/* Paint only. Every hit test belongs to the four buttons below. */
.receipt-correct-overlay {
    position: absolute;
    inset: 0;
    pointer-events: none;
}

.receipt-correct-handle {
    position: absolute;
    width: var(--receipt-handle-target);
    height: var(--receipt-handle-target);
    margin: calc(var(--receipt-handle-target) / -2) 0 0 calc(var(--receipt-handle-target) / -2);
    padding: 0;
    border: 0;
    background: transparent;
    cursor: grab;
    touch-action: none;
}

.receipt-correct-handle:active {
    cursor: grabbing;
}

/*
    The ring itself is drawn on the canvas; this is the keyboard affordance. The halo is not
    decoration - what sits behind a handle is a photograph and may be black.
*/
.receipt-correct-handle:focus-visible {
    outline: 2px solid var(--site-primary-dark);
    outline-offset: 2px;
    border-radius: 50%;
    box-shadow: 0 0 0 4px rgb(255 255 255 / 0.9);
}

/*
    Pinned to a corner rather than following the finger, because a loupe that follows the finger
    is also underneath the hand holding it.
*/
.receipt-correct-loupe {
    position: absolute;
    top: 0.75rem;
    left: 0.75rem;
    width: var(--receipt-loupe-size);
    height: var(--receipt-loupe-size);
    border-radius: 50%;
    box-shadow: 0 0 0 2px var(--site-white), 0 2px 10px rgb(15 23 42 / 0.35);
    pointer-events: none;
}

.receipt-correct-loupe.is-right {
    left: auto;
    right: 0.75rem;
}

/* The same visually-hidden idiom as the capture inputs above. */
.receipt-correct-live {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}


/* ---------------------------------------------------------------------------------------
   The modal shell, hand-rolled
   ---------------------------------------------------------------------------------------
   Built rather than reused from DevExtreme, and the sizing below is the entire reason.

   NO VIEWPORT UNIT APPEARS IN THIS BLOCK - not vh, not dvh, not svh - AND NONE MAY BE ADDED.
   Measured on an iPhone home-screen PWA and written up in CLAUDE_OVR.md: 100dvh,
   window.innerHeight and visualViewport.height all grow past documentElement.clientHeight
   after load, by 47px on one report and 14px on another. Anything sized from them hangs its
   bottom edge outside the layout viewport, where it is clipped and never painted - which here
   would be the row with the shutter button on it.

   position: fixed with inset: 0 resolves against the initial containing block, which IS
   documentElement.clientHeight, and it tracks the visual viewport without being told to. That
   second part matters too: DevExtreme reads visualViewport.offsetTop once when an overlay opens
   and never listens for changes, which is the logged "the popup lands part-way down the screen"
   defect. Nothing here positions anything from JavaScript, so it cannot have that bug.

   Safe-area insets go on the chrome and NOT on the surface: the camera preview is meant to run
   edge to edge under the notch, while nothing tappable may sit beneath it or the home indicator.
   --------------------------------------------------------------------------------------- */
.receipt-overlay {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(17, 24, 39, 0.72);
    opacity: 0;
    transition: opacity 120ms ease-out;

    /* Nothing behind this scrolls, and the overlay itself must not rubber-band on iOS. */
    overscroll-behavior: contain;
    touch-action: none;
}

.receipt-overlay.is-open {
    opacity: 1;
}

.receipt-overlay.is-hidden {
    display: none;
}

@media (prefers-reduced-motion: reduce) {
    .receipt-overlay {
        transition: none;
    }
}

.receipt-overlay-frame {
    display: flex;
    flex-direction: column;
    width: min(52rem, 96%);
    height: min(44rem, 92%);
    max-width: 100%;
    max-height: 100%;
    background: #ffffff;
    border-radius: 0.5rem;
    box-shadow: 0 1.25rem 3rem rgba(0, 0, 0, 0.35);
    overflow: hidden;
}

/*
    Edge to edge: the viewfinder, and the review on a phone. The frame then IS the viewport, so
    the rounding and the shadow would only draw a line nothing sits outside of.
*/
.receipt-overlay.is-full-bleed .receipt-overlay-frame {
    width: 100%;
    height: 100%;
    border-radius: 0;
    box-shadow: none;
    background: #0b0f19;
}

@media (max-width: 768px) {
    .receipt-overlay .receipt-overlay-frame {
        width: 100%;
        height: 100%;
        border-radius: 0;
        box-shadow: none;
    }
}

.receipt-overlay-head {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    padding-top: calc(0.75rem + env(safe-area-inset-top, 0px));
    padding-left: calc(1rem + env(safe-area-inset-left, 0px));
    padding-right: calc(1rem + env(safe-area-inset-right, 0px));
    border-bottom: 1px solid #e5e7eb;
    background: #ffffff;
}

.receipt-overlay.is-full-bleed .receipt-overlay-head {
    border-bottom-color: rgba(255, 255, 255, 0.14);
    background: #0b0f19;
    color: #ffffff;
}

.receipt-overlay-title {
    flex: 1 1 auto;
    min-width: 0;
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
    line-height: 1.3;

    /*
        min-width: 0 AND THE ELLIPSIS TOGETHER. A flex item will not shrink below its content by
        default, so a long receipt file name would push the download and close controls off the
        edge of a phone - the two things that must always be reachable.
    */
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.receipt-overlay-close {
    flex: 0 0 auto;
    width: 2.75rem;
    height: 2.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    line-height: 1;
    color: inherit;
    background: transparent;
    border: 0;
    border-radius: 0.25rem;
    cursor: pointer;
}

.receipt-overlay-close:hover {
    background: rgba(127, 127, 127, 0.18);
}

.receipt-overlay-close:focus-visible {
    outline: 2px solid #1b3f8b;
    outline-offset: 2px;
}

.receipt-overlay.is-full-bleed .receipt-overlay-close:focus-visible {
    outline-color: #ffffff;
}

/*
    An icon control in the header strip - the viewer's download. Same 44px target as the close it
    sits beside, so the two read as a pair rather than one control and one decoration.
*/
.receipt-overlay-action {
    flex: 0 0 auto;
    width: 2.75rem;
    height: 2.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    color: inherit;
    background: transparent;
    border: 0;
    border-radius: 0.25rem;
    cursor: pointer;
}

.receipt-overlay-action svg {
    width: 1.35rem;
    height: 1.35rem;
}

.receipt-overlay-action.is-hidden {
    display: none;
}

.receipt-overlay-action:hover {
    background: rgba(127, 127, 127, 0.18);
}

.receipt-overlay-action:focus-visible {
    outline: 2px solid #1b3f8b;
    outline-offset: 2px;
}

.receipt-overlay.is-full-bleed .receipt-overlay-action:focus-visible {
    outline-color: #ffffff;
}

/*
    min-height: 0 IS LOAD-BEARING, for the same reason it is on .site-main at the top of this
    file: a flex item defaults to min-height: auto, which means "at least as tall as my content".
    A tall stage would then push the footer - and the shutter with it - off the bottom of the
    screen. Deleting this one line reads as "the buttons are missing".
*/
.receipt-overlay-body {
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: auto;
    touch-action: pan-y;
    padding: 1rem;
}

.receipt-overlay.is-full-bleed .receipt-overlay-body {
    padding: 0;
    overflow: hidden;
    touch-action: none;
}

.receipt-overlay-foot {
    flex: 0 0 auto;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    padding-bottom: calc(0.75rem + env(safe-area-inset-bottom, 0px));
    padding-left: calc(1rem + env(safe-area-inset-left, 0px));
    padding-right: calc(1rem + env(safe-area-inset-right, 0px));
    border-top: 1px solid #e5e7eb;
    background: #ffffff;
}

.receipt-overlay.is-full-bleed .receipt-overlay-foot {
    border-top-color: rgba(255, 255, 255, 0.14);
    background: #0b0f19;
}

.receipt-overlay-foot-group {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
}

.receipt-overlay-foot-group.is-start {
    flex: 1 1 auto;
    justify-content: flex-start;
}

.receipt-overlay-foot-group.is-end {
    flex: 0 0 auto;
    justify-content: flex-end;
}

.receipt-overlay-button {
    min-height: 2.75rem;
    padding: 0 1rem;
    font: inherit;
    font-weight: 600;
    border: 1px solid transparent;
    border-radius: 0.25rem;
    cursor: pointer;
}

.receipt-overlay-button.is-hidden {
    display: none;
}

.receipt-overlay-button:disabled {
    opacity: 0.45;
    cursor: default;
}

.receipt-overlay-button:focus-visible {
    outline: 2px solid #1b3f8b;
    outline-offset: 2px;
}

.receipt-overlay.is-full-bleed .receipt-overlay-button:focus-visible {
    outline-color: #ffffff;
}

.receipt-overlay-button.is-primary {
    color: #ffffff;
    background: #1b3f8b;
    border-color: #1b3f8b;
}

.receipt-overlay-button.is-primary:hover:not(:disabled) {
    background: #16336f;
}

.receipt-overlay-button.is-secondary {
    color: #1b3f8b;
    background: #ffffff;
    border-color: #c7d0e0;
}

.receipt-overlay-button.is-secondary:hover:not(:disabled) {
    background: #f3f6fb;
}

.receipt-overlay-button.is-text {
    color: #1b3f8b;
    background: transparent;
}

.receipt-overlay-button.is-text:hover:not(:disabled) {
    background: rgba(27, 63, 139, 0.08);
}

.receipt-overlay.is-full-bleed .receipt-overlay-button.is-secondary,
.receipt-overlay.is-full-bleed .receipt-overlay-button.is-text {
    color: #ffffff;
    background: transparent;
    border-color: rgba(255, 255, 255, 0.35);
}

.receipt-overlay.is-full-bleed .receipt-overlay-button.is-text {
    border-color: transparent;
}

/*
    A pressed toggle, which in the viewfinder is auto-capture.

    NOT COLOUR ALONE. The label already carries the state in words, so this only has to make the
    switch readable at a glance - but a tint that was the only signal would be invisible to the
    people most likely to be using this outdoors, in sunlight, on a phone. The outline is what
    survives that.
*/
.receipt-overlay-button[aria-pressed="true"] {
    background: rgba(27, 63, 139, 0.12);
    border-color: rgba(27, 63, 139, 0.45);
}

.receipt-overlay.is-full-bleed .receipt-overlay-button[aria-pressed="true"] {
    background: rgba(255, 255, 255, 0.18);
    border-color: rgba(255, 255, 255, 0.55);
}

.receipt-overlay.is-full-bleed .receipt-overlay-button.is-secondary:hover:not(:disabled),
.receipt-overlay.is-full-bleed .receipt-overlay-button.is-text:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.14);
}

/*
    The review's own root carries height: 100%, which is fine, but making it a growing flex item
    as well means it shrinks to the body rather than overflowing it when the chrome is tall - a
    landscape phone, or a long guidance line that wraps.
*/
.receipt-overlay-body > .receipt-correct {
    flex: 1 1 auto;
    min-height: 0;
}


/* ---------------------------------------------------------------------------------------
   Viewing a receipt in place

   Installed to the home screen there is no address bar and no tab strip, so a receipt opened
   in a new window cannot be closed. receipt-viewer.js shows it here instead. Full bleed, with
   only the header strip clearing the safe-area inset - the picture itself runs to the edges,
   which is the whole reason for looking at it on a phone.
   --------------------------------------------------------------------------------------- */
.receipt-viewer-stage {
    position: relative;
    flex: 1 1 auto;

    /* Same load-bearing line as .site-main: without it a tall image pushes the header away. */
    min-height: 0;
    overflow: hidden;
    background: #000000;

    /*
        The gesture is handled in JavaScript, so the browser must not claim it first. Pinching
        inside a position: fixed overlay would zoom the visual viewport rather than the image,
        which moves the close button off screen and strands the user all over again.
    */
    touch-action: none;
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
}

/*
    transform-origin: 0 0 PAIRS WITH THE ARITHMETIC in receipt-viewer.js, which computes an
    explicit translate for every scale. A centred origin would silently add half the image's
    size to each step and the pinch would drift away from the fingers.
*/
.receipt-viewer-image {
    position: absolute;
    top: 0;
    left: 0;
    transform-origin: 0 0;
    will-change: transform;

    /* Until load fires there is no measured size, so nothing is positioned yet. */
    opacity: 0;
    transition: opacity 120ms ease-out;
}

.receipt-viewer-stage.is-loaded .receipt-viewer-image {
    opacity: 1;
}

@media (prefers-reduced-motion: reduce) {
    .receipt-viewer-image {
        transition: none;
    }
}

.receipt-viewer-stage.is-unavailable {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    padding-left: calc(1.5rem + env(safe-area-inset-left, 0px));
    padding-right: calc(1.5rem + env(safe-area-inset-right, 0px));
    padding-bottom: calc(1.5rem + env(safe-area-inset-bottom, 0px));
}

.receipt-viewer-unavailable {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.6rem;
    max-width: 24rem;
    text-align: center;
    color: #ffffff;
}

.receipt-viewer-filename {
    margin: 0;
    font-weight: 600;
    word-break: break-word;
}

.receipt-viewer-note {
    margin: 0;
    color: rgba(255, 255, 255, 0.78);
}

.receipt-viewer-size {
    margin: 0 0 0.4rem 0;
    font-size: 0.875rem;
    color: rgba(255, 255, 255, 0.6);
}

/*
    The download anchor inside the panel is styled as a button, so it needs the button's own
    centring - an <a> is inline and would sit on the text baseline.
*/
.receipt-viewer-unavailable .receipt-overlay-button {
    display: inline-flex;
    align-items: center;
    text-decoration: none;
}


/*
    A PDF, rendered by receipt-pdf.js into a column of page canvases.

    THE COLUMN IS TRANSFORMED EXACTLY AS AN IMAGE IS - same transform-origin, same arithmetic in
    receipt-viewer.js - so pinching, dragging and double-tapping a folio behave identically to
    doing it to a photograph. That is the whole reason the pages are absolutely positioned inside
    one element rather than laid out as a scrolling list.
*/
.receipt-pdf-column {
    position: absolute;
    top: 0;
    left: 0;
    transform-origin: 0 0;
    will-change: transform;
    opacity: 0;
    transition: opacity 120ms ease-out;
}

.receipt-viewer-stage.is-loaded .receipt-pdf-column {
    opacity: 1;
}

@media (prefers-reduced-motion: reduce) {
    .receipt-pdf-column {
        transition: none;
    }
}

/*
    A page is white BEFORE it has been drawn, and that matters: pages are rendered on demand, so
    one scrolled to quickly is briefly empty. An empty white rectangle of the right size reads as
    paper that has not loaded; a transparent one reads as a hole in the document.
*/
.receipt-pdf-page {
    background: #ffffff;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.4);
    overflow: hidden;
}

.receipt-pdf-page.is-failed {
    background: repeating-linear-gradient(
        45deg, #f3f4f6, #f3f4f6 10px, #e5e7eb 10px, #e5e7eb 20px);
}

.receipt-pdf-canvas {
    display: block;
}

/*
    Says what is happening while a PDF is being fetched and parsed, which on a phone on a weak
    connection is long enough for a black screen to look like a failure.
*/
.receipt-viewer-status {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    margin: 0;
    padding: 0.5rem 1rem;
    border-radius: 0.25rem;
    color: #ffffff;
    background: rgba(0, 0, 0, 0.6);
    pointer-events: none;
}

/* ---------------------------------------------------------------------------------------
   The live viewfinder
   ---------------------------------------------------------------------------------------
   A camera preview with the detected document outline drawn over it while the user is aiming.
   The stage is black and bleeds to every edge; only the toolbar carries the safe-area inset.
   --------------------------------------------------------------------------------------- */
.receipt-viewfinder-stage {
    position: relative;
    flex: 1 1 auto;
    min-height: 0;
    background: #000000;
    overflow: hidden;

    /* Dragging and pinching here must not scroll or zoom the page behind. */
    touch-action: none;
}

/*
    object-fit: contain, NOT cover. Cropping the preview would show the user a frame that is not
    the frame being captured, so a receipt could sit comfortably inside the picture and still come
    out clipped - the exact failure this feature exists to prevent.
*/
.receipt-viewfinder-video {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    background: #000000;
}

.receipt-viewfinder-overlay {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.receipt-viewfinder-stage.is-failed .receipt-viewfinder-video {
    display: none;
}

.receipt-viewfinder-guidance {
    flex: 0 0 auto;
    margin: 0;
    padding: 0.6rem 1rem;
    padding-left: calc(1rem + env(safe-area-inset-left, 0px));
    padding-right: calc(1rem + env(safe-area-inset-right, 0px));
    font-size: 0.95rem;
    text-align: center;
    color: #ffffff;
    background: #0b0f19;
}

/*
    The live-camera button is a <button>, not the hidden-input-and-label pair the other two use,
    so the adjacent-sibling focus ring at .receipt-input:focus-visible + .receipt-capture-button
    cannot reach it. It needs its own.
*/
.receipt-capture-button.is-live:focus-visible {
    outline: 2px solid #1b3f8b;
    outline-offset: 2px;
}

/* ---------------------------------------------------------------------------------------
   History and popups
   --------------------------------------------------------------------------------------- */
.history-list {
    margin: 0;
    padding: 0;
    list-style: none;
}

.history-list li {
    display: grid;
    grid-template-columns: 11rem 1fr;
    gap: 0.2rem 1rem;
    padding: 0.35rem 0;
    border-bottom: 1px solid var(--site-border);
}

.history-list li:last-child {
    border-bottom: 0;
}

.history-when {
    color: var(--site-text-muted);
    font-size: 0.8125rem;
}

.history-comment {
    grid-column: 2;
    font-size: 0.8125rem;
    color: var(--site-text-muted);
}

.popup-form {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.popup-form label {
    font-size: 0.8125rem;
    color: var(--site-text-muted);
}

.tab-form-host {
    padding: 0.75rem;
    overflow-y: auto;
    height: 100%;
}

/*
    A tab whose body is a GRID rather than a form - the counterpart to .tab-form-host above.

    The tab panel already gives .dx-multiview-item-content a definite height, so there is nothing
    here to repair and no height to calculate: this only has to be a flex column, and then a
    .grid-host inside it takes whatever height its siblings leave. The grid says height: "100%"
    like every other grid in the application and a pixel height appears nowhere.

    overflow: hidden, NOT auto, and that is the whole difference from .tab-form-host. A scrolling
    tab wrapped around a scrolling grid is the two-scrollbar bug: the grid can only be the thing
    that scrolls if it is bounded, rather than free to grow and push the tab instead.
*/
.tab-fill-host {
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
    padding: 0.75rem;
    height: 100%;
}

/* =======================================================================================
   NARROW SCREENS

   The site is used from a phone inside an embedded WebView as much as from a desktop, so this
   is not a nicety. Four things change below 768px and each has a reason:

     1  The header collapses to one navy bar, and its nav strip moves to the BOTTOM of the
        screen as a four-slot bar - see THE BOTTOM NAVIGATION BAR below.
     2  Forms and the header definition list collapse to one column.
     3  Buttons grow. A 32px button is a desktop button; a thumb needs 44.
     4  The footer goes. Its build version moves into the bottom bar's More menu.

   The GRIDS need nothing here: they are given columnHidingEnabled and a hiding priority per
   column, so DevExtreme drops the least important columns and offers the row's own detail
   view instead. That is one grid definition rather than two layouts to keep in step.
   ======================================================================================= */
@media (max-width: 768px) {
    /*
        THE TWO TIERS COLLAPSE INTO ONE NAVY BAR.

        150px of chrome is 18% of a 390x844 phone, and this application is served inside a
        WebView where that space is the expense report. The utility strip's support line goes,
        and so does the account menu - the bottom bar's More menu is the account menu at this
        width. What is left is the brand, which is also the Home link.

        Flipping the header variables rather than re-stating colors keeps the nav rules above
        working unmodified: on navy, the black text and the cyan underline they name would be
        invisible and near-invisible respectively.
    */
    :root {
        --site-header-bg: #002d72;
        --site-header-fg: rgba(255, 255, 255, 0.82);
        --site-header-fg-active: #ffffff;
        --site-header-rule: #ffffff;
    }

    /*
        THE TWO WRAPPERS DISSOLVE - they are not hidden.

        display: contents removes the wrapper boxes while keeping their children, so .site-user
        and the brand both become flex items of .site-header itself and sit on one row.

        DO NOT SIMPLIFY THIS TO display: none ON THE UTILITY STRIP. It looks like dead weight now
        that the signed-in account menu is hidden below, but .site-user is ALSO where _Layout
        renders the plain SIGN IN LINK for a visitor who is not authenticated - and that visitor
        has no bottom bar to fall back on, because its host element only exists inside the
        isAuthenticated branch. Hiding the strip would leave the login page with no way in.

        Because the children now come in DOM order - support, .site-user, brand - each is given
        an explicit order below. That coupling is called out in _Layout.cshtml.
    */
    .site-header {
        flex-direction: row;
        align-items: center;
        min-height: 48px;
        gap: 0.75rem;
        /* The wrappers carried the background; with contents they no longer can. */
        background: var(--site-header-bg);
        border-bottom: 3px solid var(--site-accent);
        padding: env(safe-area-inset-top, 0px) 0.6rem 0 0.6rem;
        margin-top: calc(0px - env(safe-area-inset-top, 0px));
    }

    .site-header-utility,
    .site-header-main {
        display: contents;
    }

    .site-header-support {
        display: none;
    }

    .site-brand { order: 1; }
    /* Still needed: at this width .site-user holds only the signed-out Sign in link. */
    .site-user { order: 3; }

    /*
        THE HEADER'S ACCOUNT MENU GOES. The More menu in the bottom bar already carries My
        account, Change password and Sign out - from the very same accountMenuItems() array - so
        leaving this rendered puts one item list on the screen twice, a screen apart. Of the two,
        this is the worse: a 13px name in the top corner, at the far end of the screen from the
        thumb that has to reach Sign out, and the last element competing with the brand for a
        width that .site-nav and .site-footer have already given back.

        WHY .site-user IS NOT HIDDEN INSTEAD. That container also holds #logout-form, and Sign
        out works by requestSubmit() on it. A form inside a display: none subtree does still
        submit - rendering is not a precondition - but the sign-out path is the one control
        nobody may lose, and 0.6rem of header width is not worth putting it inside a hidden
        subtree to find out. Emptied of its visible children, .site-user is a zero-width flex
        item; it costs one `gap` after the brand and nothing else.

        WHY renderUserMenu STILL BUILDS THE WIDGET. This breakpoint flips on ROTATION with no
        reload - a 390x844 phone turned sideways is 844px wide, and then this menu is the only
        account menu, because the bottom bar is gone at that width. Hiding in CSS is what makes
        both orientations correct without any JavaScript re-entry.

        ONLY THE TRIGGER, not #user-menu beside it. That div is DevExtreme's host and renders
        empty at zero width either way, so hiding it would buy nothing - and it would leave a
        widget initialized on a display: none element, which is the one thing that could make
        the rotation case above fail.
    */
    .user-menu-trigger {
        display: none;
    }

    /*
        THE HEADER'S NAV STRIP GOES, and the bottom bar replaces it.

        It has to be one or the other: leaving both would put every destination on the screen
        twice, and the header copy is the worse of the two - it is at the far end of the screen
        from a thumb, and it is the only element on the site that ever needed overflow-x: auto,
        so a user with several grants had to SCROLL A BAR SIDEWAYS to find Approvals. Removing it
        also gives the brand and the account menu the whole width back.

        display: none rather than removing it from the markup, because site.js READS these
        anchors to build the bottom bar - they are still the one authoritative list of what this
        account may be offered. A hidden element is still in the DOM and still queryable, which
        is the whole mechanism.

        No `order` on .site-nav any more; it is not a flex item. Order 2 is deliberately left
        vacant rather than renumbering .site-user, so the two remaining values still say where
        they sit relative to the brand.
    */
    .site-nav {
        display: none;
    }

    /*
        The footer's thirty pixels are the expense report on a 390x844 screen. Its build version
        is not lost - renderBottomNav reads it out of here and appends it to the More menu, which
        is why this is display: none on a still-rendered element rather than a change to
        _Layout.cshtml.
    */
    .site-footer {
        display: none;
    }

    /* The hairline belongs to the support line, which is not shown at this width. */
    .site-header-support > * + * {
        border-left: none;
        padding-left: 0;
    }

    /*
        The wordmark replaces the logo here - the corporate mark is near-black and would not
        read on navy. See the note on .site-brand.
    */
    .site-brand img {
        display: none;
    }

    .site-brand .site-brand-text {
        display: block;
        font-size: 0.9375rem;
        color: var(--site-white);
    }

    .site-main {
        padding: 0.6rem;
    }

    /* ===================================================================================
       THE BOTTOM NAVIGATION BAR

       Three destinations and a permanent More menu, along the bottom of the screen where a
       thumb already is. site.js decides WHICH three from the data-mobile-order attributes on
       the header's own anchors; this decides only how they look.

       IT IS NOT position: fixed, AND THAT IS THE LOAD-BEARING PART.

       <body> is already display: flex, flex-direction: column, height: 100dvh, overflow:
       hidden, and only .site-main scrolls - see the top of this file. So a bar declared as the
       last flex child takes its own space OUT of the layout: .site-main simply gets less of
       the column, and the height chain that ends at a .grid-host resolves against the smaller
       number on its own.

       A fixed overlay would have needed all of the following instead, and the first two would
       have been discovered as bugs rather than written on purpose: a padding-bottom on
       .site-main to stop the bar covering the last row of every full-height grid, the same
       again inside .grid-host for the flush pages, and a z-index above the grids' sticky
       header row. Do not pin this.
       =================================================================================== */
    .site-bottom-nav {
        display: flex;
        flex: 0 0 auto;
        align-items: stretch;

        /*
            The same navy and the same border as the header, by naming the same variables it
            names rather than restating #002d72. The five --site-header-* properties flip as a
            set at the top of this block; this is one more consumer of them and changes none.
        */
        background: var(--site-header-bg);
        border-top: 3px solid var(--site-accent);

        /*
            THE HOME INDICATOR. On an iPhone the bottom ~34px of the screen belongs to the
            system gesture area, and without this the labels sit under it and the last slot
            competes with the swipe-up. The inset resolves to zero on every device that has no
            such area, so this costs nothing anywhere else.

            It only resolves to anything at all because _Layout.cshtml's viewport meta carries
            viewport-fit=cover. The two go together; changing one without the other silently
            gives back the overlap.
        */
        padding-bottom: env(safe-area-inset-bottom, 0px);
    }

    /*
        One slot. flex: 1 1 0 with a zero basis so all four divide the width EVENLY regardless
        of how long their labels are - "Accounting" and "New" get the same target, which is what
        makes the bar predictable to hit without looking at it.

        min-width: 0 so a long label shrinks its own box rather than pushing the row wider than
        the screen.
    */
    .bottom-nav-item {
        position: relative;
        display: flex;
        flex: 1 1 0;
        min-width: 0;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 0.15rem;

        /* 52px - above the 44px this block gives everything else, because it is the primary
           control on the screen and it is the one hit while walking. */
        min-height: 3.25rem;
        padding: 0.35rem 0.25rem;

        /* An always-present transparent rule, so marking the current item moves nothing. */
        border-top: 3px solid transparent;
        /* The bar's own top border is the rule; this one sits inside it. */
        margin-top: -3px;

        color: var(--site-header-fg);
        text-decoration: none;
        text-align: center;

        /* The reset a <button> needs - the More slot is one. A button inherits neither the
           font nor the color. */
        background: none;
        border-left: none;
        border-right: none;
        border-bottom: none;
        font: inherit;
        cursor: pointer;
        /* Stops a double-tap being read as a zoom gesture on a control meant for one tap. */
        touch-action: manipulation;
        -webkit-tap-highlight-color: transparent;
    }

    .bottom-nav-item:hover,
    .bottom-nav-item:focus-visible {
        color: var(--site-header-fg-active);
        background: rgba(255, 255, 255, 0.1);
    }

    .bottom-nav-item:focus-visible {
        outline: 2px solid var(--site-white);
        outline-offset: -2px;
    }

    /*
        The current screen. The header marks its links with a bottom border; this marks with a
        TOP one, so on a bar at the foot of the screen the accent sits against the content it
        belongs to rather than against the edge of the display.
    */
    .bottom-nav-item.is-current {
        color: var(--site-header-fg-active);
        border-top-color: var(--site-header-fg-active);
    }

    .bottom-nav-icon {
        /* DevExtreme's own icon font, already loaded for the grids - no new asset. */
        font-size: 1.25rem;
        line-height: 1;
    }

    .bottom-nav-label {
        font-size: 0.6875rem;
        font-weight: 700;
        line-height: 1.2;
        /* One line. A label that wraps changes the height of one slot and not the others. */
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        max-width: 100%;
    }

    /*
        The count - how many reports are waiting for this person's approval.

        On the icon's top-right corner, and CYAN WITH BLACK TEXT rather than white on cyan:
        #009dd9 is 3.08:1 against white either way round, and 6.82:1 against black. The palette
        note in Part 2 says the same thing - cyan is a surface for dark text, never a text
        colour. Red was the other candidate and was rejected: a queue of work is not an error.
    */
    .bottom-nav-badge {
        position: absolute;
        top: 0.2rem;
        /* Half a slot, plus a little - lands on the corner of a centred icon at any width. */
        left: 55%;
        min-width: 1.05rem;
        padding: 0 0.2rem;
        border-radius: 0.6rem;
        background: var(--site-accent);
        color: #000000;
        font-size: 0.625rem;
        font-weight: 700;
        line-height: 1.05rem;
        text-align: center;
    }

    /*
        The More overlay. DevExtreme renders it into <body>, so it is reached by its cssClass
        rather than by a descendant selector from the bar.

        Room for the whole overflow list - which for an administrator is six destinations, three
        account items and the build string - without the menu itself scrolling, while still
        stopping short of covering the screen.
    */
    .bottom-nav-more-menu .dx-menu-items-container {
        max-height: 70dvh;
        overflow-y: auto;
    }

    /* 44px per row. A menu is not exempt from being operated by a thumb. */
    .bottom-nav-more-menu .dx-menu-item {
        min-height: 2.75rem;
    }

    .tile-grid {
        grid-template-columns: 1fr;
    }

    .detail-list {
        grid-template-columns: 1fr;
        gap: 0.1rem;
    }

    .detail-list dd {
        margin-bottom: 0.4rem;
    }

    .history-list li {
        grid-template-columns: 1fr;
    }

    .history-comment {
        grid-column: 1;
    }

    .page-heading .page-heading-note {
        /* Full width under the title rather than squeezed beside it. */
        flex-basis: 100%;
    }

    /* The picture, the "×" on its corner and the Detach button all follow this one number. */
    .receipt-thumb {
        --receipt-thumb-size: 5.5rem;
    }

    /*
        A FULLSCREEN POPUP'S WRAPPER IS THE VIEWPORT, AND DevExtreme KEEPS DECIDING OTHERWISE.
        Two separate things it gets wrong, both fixed here. See CLAUDE_OVR.md for the measurements.

        HEIGHT. dxOverlay writes an inline pixel height of window.innerHeight onto the wrapper, and
        that number runs past documentElement.clientHeight on this device - 844 against 797 - so
        Save and Cancel landed at 771..835 with everything past 797 clipped away.

        TRANSFORM. positionWrapper asks for {my:"top left", at:"top left", of:window}, which reduces
        to location = atLocation, and on a phone atLocation is max(scrollTop, visualViewport
        .offsetTop). So the wrapper is translated down by however far iOS has scrolled the visual
        viewport - which the keyboard does every time the account picker opens. It is read once, at
        geometry time, and nothing in DevExtreme listens to visualViewport, so choosing an account
        (a form reshape, hence a re-render) planted the whole popup 194px down and left it there.

        left/top ARE ALREADY INLINE ZERO - resetPosition sets them and then move() writes the offset
        as a transform, so overriding them instead of the transform moves nothing.

        NOT ON .dx-popup-fullscreen. The show animation slides the CONTENT through this same
        property; forcing it there kills the slide-in. Only the wrapper is misplaced, and the
        wrapper is never animated.

        SCOPED WITH :has BECAUSE THIS IS ONLY TRUE OF FULLSCREEN. An overlay anchored to an element
        - every dropdown, since _getVisualContainer falls back to position.of - has an absolute
        wrapper sized and placed against that element, and both rules would be wrong for it.
    */
    .dx-overlay-wrapper:has(> .dx-popup-fullscreen) {
        height: 100% !important;
        transform: none !important;
    }

    .dx-popup-fullscreen {
        display: flex !important;
        flex-direction: column;
        position: absolute !important;
        left: 0px !important;
        top: 0px !important;
    }

    /*
        min-height: 0 IS LOAD-BEARING - the same flex trap as .site-main at the top of this file.
        Without it this item cannot shrink below its content, so a tall form pushes the toolbar
        past the popup's bottom edge, where .dx-overlay-content's overflow: clip removes it.
        overflow: auto because clearing the height also collapses the dxScrollView DevExtreme
        wraps the edit form in - it is height: 100% of this element - so this has to scroll instead.
    */
    .dx-popup-fullscreen .dx-popup-content {
        flex-grow: 1 !important;
        height: unset !important;
        min-height: 0;
        overflow: auto;
    }

    /* The bar carrying Save and Cancel, kept off the home indicator - as .site-bottom-nav is. */
    .dx-popup-fullscreen .dx-popup-bottom {
        flex: 0 0 auto;
    }

    .dx-popup-fullscreen .dx-popup-title {
        flex: 0 0 auto;
        padding-top: env(safe-area-inset-top, 0px) !important;
    }

    .dx-popup-fullscreen .dx-popup-title:has(.dx-popup-cancel) {
        padding-bottom: env(safe-area-inset-top, 0px) !important;
    }

    .dx-popup-fullscreen .dx-popup-title .dx-toolbar-before .dx-popup-cancel {
        min-width: 5rem !important;
    }

    /*
        A 44px touch target. Apple's HIG minimum, and DevExtreme sizes its controls for a pointer
        at 26px. Applies to every button at this width, not only the ones in a popup.
    */
    .dx-popup-fullscreen .dx-popup-bottom .dx-toolbar-items-container,
    .dx-button {
        min-height: 2.75rem;
        min-width: 2.75rem;
    }

    .dx-popup-fullscreen .dx-toolbar-items-container .dx-item-content:has(.dx-button) {
        display: flex !important;
    }

    .dx-list-items .dx-list-item-content {
        font-size: 1.25rem !important;
    }

    .dx-toolbar-items-container .dx-button {
        display: flex;
        flex-direction: column;
    }

    .dx-button .dx-button-content {
        display: flex;
        flex-grow: 1 !important;
    }
    /*
        AND THE GRID'S TOOLBAR HAS TO GROW WITH THEM.

        dx-toolbar pins its items container to 26px, so the rule above - which makes the add
        button 44px - leaves an 18px overhang that lands on the column headers underneath. The
        band has to be told the taller number; it will not work it out.

        AN EXPLICIT HEIGHT, NOT auto. The before and after sections resolve their own height
        against this one, so releasing it collapses the toolbar and the heading inside it
        disappears entirely - measured on 24.2.5. Matched to .dx-button above: change one and the
        other has to move with it.
    */
    .dx-datagrid .dx-datagrid-header-panel .dx-toolbar,
    .dx-datagrid .dx-datagrid-header-panel .dx-toolbar .dx-toolbar-items-container {
        height: 2.75rem;
    }

    .dx-datagrid .dx-data-row {
        height: 2.5rem !important;
    }

    .dx-datagrid .dx-data-row > td {
        align-content: center;
    }

    .dx-texteditor-input {
        min-height: 2.5rem;
    }

    /*
        16px, OR iOS SAFARI ZOOMS THE PAGE. Focusing an input whose font-size is below 16px makes
        Safari scale the viewport up to meet it, and it does not scale back when the field is left.
        The user is then pinching out after every field just to see the rest of the screen.

        WORST INSIDE THE EXPENSE POPUP, where pinching back out is awkward or impossible, so a
        zoom that arrives on the first tap stays for the whole line.

        1rem AND NOT A LARGER NUMBER: 16px is exactly the threshold, so this is the smallest text
        that stops the zoom - anything more would be a design change rather than a fix.

        THE EDITORS INHERIT 12px FROM DevExtreme, which sets it on .dx-widget rather than on the
        input, so a rule on the input itself is enough to win - no specificity fight and no
        !important. Measured on 24.2.5: every text editor computed to 12px, and .field input to
        14px through `font: inherit`, so the sign-in page zoomed as well.

        AUTOCOMPLETE IS NAMED SEPARATELY, AND IT HAS TO BE. The theme carries
        `.dx-autocomplete .dx-texteditor-input { font-size: 1em }` - two classes against the one
        below it, so it wins on specificity no matter how late this file loads, and 1em is the 12px
        it inherits from .dx-widget. Merchant was the only field in the expense popup still zooming
        because it is the only dxAutocomplete in it. Matching the theme's two classes here is enough
        to take it back on source order; it is the ONLY multi-class font-size rule the theme aims at
        an editor input, so nothing else needs the same treatment.

        NOT SOLVED WITH maximum-scale OR user-scalable=no on the viewport tag. That stops the
        zoom by stopping the user zooming at all, which breaks the page for anybody who needs to
        magnify it - and current iOS ignores it anyway.
    */
    .dx-texteditor-input,
    .dx-autocomplete .dx-texteditor-input,
    .field input[type="text"],
    .field input[type="password"],
    .field input[type="email"],
    input[type="search"],
    input[type="number"],
    input[type="tel"],
    input[type="url"],
    input[type="date"],
    textarea,
    select {
        font-size: 1rem;
    }

    .form-actions {
        /* Stacked and full width - side-by-side buttons at this width are a mis-tap. */
        flex-direction: column;
        align-items: stretch;
    }

    .form-actions .dx-button {
        width: 100%;
    }
}
