/*
 * The dashboard's only global stylesheet. MudBlazor does the styling; this file holds just what it has
 * no equivalent for. No colour is ever written here: anything visual reads a theme variable
 * (var(--mud-palette-...)), so both palettes stay correct by construction.
 */

/* Touch targets: every tappable control is at least 44 px tall (WCAG 2.5.5). MudBlazor's defaults for
   these run 32-40 px, which is right for a mouse and too small for a thumb. Icon buttons are 48 px
   already. With a mouse or a trackpad as the only pointer (pointer: fine) on a window wide enough to be a desktop's (600 px
   and up), buttons, toggles and chips keep MudBlazor's own heights, a little over 36 px and 32 px, so screens read compact
   and professional (GitHub #295); a phone, a tablet, a touch screen - and a window as narrow as a phone's, whatever its
   pointer (GitHub #561: a phone's browser measured with a mouse's pointer found every button 36-38 px) - keeps 44 px.
   Navigation links, list items and menu items keep 44 px everywhere. */
.mud-nav-link,
.mud-button-root.mud-button,
.mud-list-item-clickable,
.mud-menu-item,
.mud-toggle-item,
.mud-chip.mud-clickable {
    min-height: 44px;
}

@media (pointer: fine) and (min-width: 600px) {
    .mud-button-root.mud-button,
    .mud-toggle-item {
        min-height: 36px;
    }

    .mud-chip.mud-clickable {
        min-height: 32px;
    }
}

/* A tip's key ("Rotate right (R)") is for a keyboard: without a fine pointer - a phone, a tablet - the tip says the action alone
   (GitHub #562). The control's aria-keyshortcuts still names the key to a screen reader. */
@media not all and (pointer: fine) {
    .hint-key {
        display: none;
    }
}

/* A chip's leading icon sits inside its outline (GitHub #506). MudBlazor pulls it 4 px into the chip's 8 px padding and sets it at
   1.125 rem in a 24 px chip, so a filled glyph (a check, a speech bubble) met the outline - and with larger text on a phone the
   outline ran through it. Here it keeps the padding's full width, one size down, and the gap to the words is the same 4 px.
   Written ahead of the chips that size their own icons (field-badge), which win by loading later. */
.mud-chip.mud-chip-size-small .mud-chip-icon {
    margin-inline-start: 0;
    margin-inline-end: 4px;
    font-size: 1rem;
    flex-shrink: 0;
}

/* A text field or a select is 44 px tall under a finger (GitHub #295). MudBlazor's dense outlined field pads its text 10.5 px
   above and below, 40 px in all - a mouse's size, and the height of every search box, filter and dialog field in the
   dashboard. Without a fine pointer the padding grows to 12.5 px; with a mouse or a trackpad nothing changes. A multi-line
   field is several lines tall already and is left alone. Each rule is as strong as the MudBlazor rule it overrides and loads
   after it. */
@media not all and (pointer: fine) {
    .mud-input > input.mud-input-root-outlined.mud-input-root-margin-dense,
    div.mud-input-slot.mud-input-root-outlined.mud-input-root-margin-dense {
        padding-top: 12.5px;
        padding-bottom: 12.5px;
    }
}

/* The small buttons that sit inside something else - the X on a chip (18 px), the tour card's close (26 px) - keep their look
   and their place and are a 44 px target to a finger: the button itself is 44 px, pulled back by negative margins to the room
   the small one took, so a tap near the X closes and never adds the chip it is on (GitHub #295). With a mouse nothing changes.
   The chip's own margins (6 px before, 4 px on a small chip, and -4 px after) are kept inside the new ones. */
@media not all and (pointer: fine) {
    .mud-chip .mud-icon-button.mud-chip-close-button {
        width: 44px;
        height: 44px;
        margin-block: -13px;
        margin-inline-start: -7px;
        margin-inline-end: -17px;
    }

    .mud-chip.mud-chip-size-small .mud-icon-button.mud-chip-close-button {
        margin-inline-start: -9px;
    }

    .guided-tour-head .mud-icon-button {
        min-width: 44px;
        min-height: 44px;
        margin: -9px;
    }
}

/* A link standing alone on its line (not a phrase in a sentence): under a finger it is a 44 px target, with a mouse it keeps
   its line's own height (GitHub #295). */
@media (pointer: coarse) {
    .link-row {
        display: inline-flex;
        align-items: center;
        min-height: 44px;
    }
}

/* Small icon buttons that stand alone - a toast's Close (26 px), the template panel's Move up and Move down (26 px) - are a
   44 px target under a finger and on a phone's width (GitHub #539): the width counts too, since a window that narrow is
   used by touch far more often than not. With a mouse on a wide window nothing changes. The toast's own close button is
   MudBlazor's (.mud-snackbar-close-button); the panel's carry .touch-icon-button. A toast wraps its text anywhere it must
   rather than run off the screen (its addresses break after a slash or a dot: Shared/States/ToastWords). */
@media (pointer: coarse), (max-width: 599.98px) {
    .mud-snackbar .mud-icon-button.mud-snackbar-close-button,
    .mud-icon-button.touch-icon-button {
        min-width: 44px;
        min-height: 44px;
    }
}

/* A field's Clear (x) button (the finders' on the Credits and System pages, GitHub #723, and every Clearable field) is 26 px in MudBlazor - a
   mouse's size and too small for a thumb. Under a finger, and on a phone's width whatever its pointer (GitHub #539, #561), it is a 44 px
   target pulled back by negative margins to the room the 26 px one took, so the field's box and its text do not move, as the chip's close button
   above (GitHub #295). With a mouse on a wide window nothing changes. MudBlazor gives it 8 px after (edge-margin-end), kept inside the new margin. */
@media (pointer: coarse), (max-width: 599.98px) {
    .mud-input-control .mud-input-clear-button.mud-icon-button {
        width: 44px;
        height: 44px;
        margin-block: -9px;
        margin-inline-start: -9px;
        margin-inline-end: -1px;
    }
}

/* A toast sits under the modal layer (GitHub #599): one raised just before a dialog opened - "Undone: ...", a confirmation's
   question - was drawn over the dialog's dimmed backdrop and its bottom edge. Above the app bar, the drawer and the menus still. */
#mud-snackbar-container {
    z-index: calc(var(--mud-zindex-dialog) - 1);
}

/* On the review screen a toast never covers the value's Accept and Correct (GitHub #599): it stands over the drawing, which holds no
   button there. From 1280 px the drawing is the middle pane, under the toasts' own place, bottom centre. From 960 to 1279 px the
   value's panel stands where the list is, at the left, and the drawing at the right: the toast goes to the bottom right. On a phone
   held upright the value's sheet and its buttons are the foot of the screen: the toast goes to the top, under the header's bar. Held
   sideways the sheet is a column at the right: the toast goes to the bottom left, no wider than the drawing beside it. */
@media (min-width: 960px) {
    body:has(.sheet-review[data-arrangement="twopanes"]) #mud-snackbar-container.mud-snackbar-location-bottom-center {
        left: auto;
        right: 24px;
        transform: none;
    }
}

@media (max-width: 959.98px) {
    body:has(.sheet-review[data-arrangement="phone"]) #mud-snackbar-container.mud-snackbar-location-bottom-center {
        top: calc(var(--sticky-bars-top-height, var(--mud-appbar-height)) + 8px);
        bottom: auto;
    }

    body:has(.sheet-review[data-arrangement="phone"]) #mud-snackbar-container.mud-snackbar-location-bottom-center .mud-snackbar {
        margin-top: 0;
        margin-bottom: 8px;
    }
}

@media (max-width: 959.98px) and (max-height: 480px) {
    body:has(.sheet-review[data-arrangement="phone"]) #mud-snackbar-container.mud-snackbar-location-bottom-center {
        top: auto;
        bottom: 16px;
        left: 16px;
        transform: none;
    }

    body:has(.sheet-review[data-arrangement="phone"]) #mud-snackbar-container.mud-snackbar-location-bottom-center .mud-snackbar {
        max-width: calc(100vw - var(--sheet-side-panel-width, 340px) - 48px);
    }
}

/* For a custom tappable area (the brand link, the account menu's avatar). */
.touch-target {
    min-height: 44px;
    min-width: 44px;
}

/* What only a keyboard can use - a button's key after its words, the review screen's keyboard shortcuts button, the guided
   tour's keys line - is decided here, once, by the pointer and never by the width (GitHub #400): hidden where the main
   pointer is a finger (pointer: coarse), a phone or a tablet however wide it is held; shown with a mouse or a trackpad
   however narrow the window, and where there is no pointer at all. The keys themselves still work wherever a keyboard is
   attached, and each control still names its key to a screen reader (aria-keyshortcuts). */
@media (pointer: coarse) {
    .hidden-on-touch {
        display: none !important;
    }
}

/* A date picker's calendar (GitHub #362), for every date field (DateField): MudBlazor draws each day 36 px with 2 px either
   side, a mouse's size, its month arrows and years 40 px, and the heading between the arrows 23 px. Without a fine pointer -
   a phone, a tablet, a touch screen - each day is a 44 px target like every other tappable control, its weekday heading as
   wide so the columns stay under it: seven of them, edge to edge, fill the calendar's 310 px (308). The arrows and the years
   are 44 px too, and so is the heading, which is the way to the months and the years now the toolbar above the calendar is
   gone (GitHub #370). With a mouse or a trackpad the calendar keeps MudBlazor's compact size (GitHub #295). Same strength
   as MudBlazor's rules, so this file, loaded after, decides (DatePickerTouchTests). */
@media not all and (pointer: fine) {
    .mud-picker-calendar .mud-day {
        width: 44px;
        height: 44px;
        margin: 0;
    }

    .mud-picker-calendar-header-day .mud-day-label {
        width: 44px;
        margin: 0;
    }

    .mud-picker-calendar-header-switch > .mud-icon-button {
        padding: 10px;
    }

    .mud-picker-calendar-header-switch .mud-picker-calendar-header-transition {
        height: 44px;
    }

    .mud-picker-year-container .mud-picker-year {
        height: 44px;
    }
}

/* A select's or an autocomplete's list is never taller than the room on one side of its field (GitHub #363). MudBlazor opens
   a list above its field where it does not fit below (#355), but its 300 px height is fixed, and once a phone's on-screen
   keyboard has shrunk the page (interactive-widget=resizes-content, App.razor) neither side had 300 px: the list was pushed
   back on screen over its own field, hiding what was being typed. Half the page less a field's height always fits on one
   side or the other, so the list hangs beside the field and scrolls. On any screen at least 680 px tall - every phone with no
   keyboard open, every laptop - this is still 300 px, so nothing else changes. It must beat the height MudBlazor writes on
   the list itself (MaxHeight, an inline style), hence !important; only these lists hang from the field's own width. */
.mud-popover.mud-popover-relative-width {
    max-height: min(300px, calc(50dvh - 40px)) !important;
}

/* A visible focus ring for keyboard users on every control (WCAG 2.4.7, GitHub #44), in the safety-orange highlight: 3:1
   or better against every layer a control sits on, in both palettes (ThemeContrastTests). The mouse and touch never
   trigger :focus-visible.
   It is written at specificity (0,3,0) - :root, :focus-visible and the :not() - because MudBlazor clears the browser's
   ring with rules a bare :focus-visible (0,1,0) loses to, however late it loads: a:focus-visible and button:focus at
   (0,1,1), an expansion panel's header at (0,2,0), the split panel's divider at (0,3,0), whose tie this file wins by
   loading after MudBlazor's (FocusRingTests). It is no stronger than that: a component's own scoped ring - the review
   table's cells, FieldTable.razor.css - is (0,3,0) too and loads after this file, so it keeps the last word.
   Left out by the :not():
   - an element only script focuses (tabindex="-1": the page title after a navigation), which is not a control;
   - the inside of an SVG drawing: the review screen's boxes show focus as a halo (SheetViewer.razor.css);
   - a text field or a select (MudBlazor's input root), whose outline already turns the primary colour at double width
     on focus - for a click too, since typing follows - so a ring as well would draw two edges around it.
   .focus-ring-pinned draws the same ring on a control without focus, for the gallery's still pictures (KeyboardFocusDemo);
   a navigation link takes it on the wrapper MudBlazor draws round the link, and a switch, a checkbox or a radio on the
   wrapper round its input (the last rule below). */
:root :focus-visible:not([tabindex="-1"], svg *, .mud-input-root),
:root .focus-ring-pinned:not(:has(input), .mud-nav-item),
:root .mud-nav-item.focus-ring-pinned > .mud-nav-link {
    outline: 2px solid var(--speccapture-highlight);
    outline-offset: 2px;
}

/* Focus the review screen moved to a value for a person who has not used the keyboard - a click or a tap opened the screen -
   draws no ring (GitHub #492); wwwroot/js/reviewShortcuts.js marks it data-quiet-focus until the next key press. Written after
   the ring above at the same strength, so it wins by loading later. */
:root [data-quiet-focus]:focus-visible {
    outline: none;
}

/* Just inside a control that reaches the edge of what holds it - a navigation link, a menu item, a list row, a panel's
   header, a tab, a toggle, a whole-row link, a box that scrolls sideways - or has no edge of its own, like an icon button
   without a fill, which often sits against its toolbar's edge: drawn outside, the scrolling container around it would cut
   the ring off. */
:root :is(.mud-nav-link, .mud-menu-item, .mud-list-item, .mud-expand-panel-header, .mud-tab, .mud-toggle-item, .row-link,
          .scroll-region, .mud-icon-button:not(.mud-button-filled)):is(:focus-visible, .focus-ring-pinned),
:root .mud-nav-item.focus-ring-pinned > .mud-nav-link {
    outline-offset: -2px;
}

/* A switch, a checkbox and a radio take focus on an invisible input inside MudBlazor's round button: the ring goes on
   that circle, around the thumb or the box. */
:root .mud-icon-button:has(input:focus-visible),
:root .focus-ring-pinned .mud-icon-button:has(input) {
    outline: 2px solid var(--speccapture-highlight);
    outline-offset: -2px;
}

/* A link inside a sentence is underlined at rest (WCAG 1.4.1, GitHub #98). A link's colour is the primary ink, which
   differs from the secondary text around it by only 2.2:1 in light and 1.8:1 in dark - colour alone would need 3:1 - and
   MudLink's default underline (Underline.Hover) appears only under a mouse, which a phone does not have. Running text is
   a paragraph, a list item, any MudText or an alert's message. A link that stands alone - a whole-row link, the brand
   mark, a list row's title - sits in none of them or sets Underline.None, and keeps MudBlazor's look (InlineLinkTests). */
p .mud-link.mud-link-underline-hover,
li .mud-link.mud-link-underline-hover,
.mud-typography .mud-link.mud-link-underline-hover,
.mud-alert-message .mud-link.mud-link-underline-hover {
    text-decoration: underline;
    text-underline-offset: 0.2em;
}

/* Layered surfaces: menus and dialogs float one step above the cards they open from. MudBlazor's palette
   has a single surface colour, so the raised one comes from the theme's own variable. */
.mud-popover.mud-paper,
.mud-dialog {
    background-color: var(--speccapture-surface-raised);
}

/* A dialog opens at its top (GitHub #660, wwwroot/js/dialogFocus.js): where its first control is out of sight, focus goes to the
   dialog itself, which names its title for a screen reader. It is not a control, so it takes focus without a ring. */
.mud-dialog:focus,
.mud-dialog:focus-visible {
    outline: none;
}

/* The box of reasons Add field refused (GitHub #661) takes focus from a script, which brings it into view and has it read as an
   alert; it is not a control, so it takes focus without a ring. */
.why-not-added:focus,
.why-not-added:focus-visible {
    outline: none;
}

/* After each navigation the page title is focused so screen readers announce it; it is not a control,
   so it takes focus without drawing a ring. */
h1:focus,
h1:focus-visible {
    outline: none;
}

/* "Skip to content" (WCAG 2.4.1, GitHub #65): the signed-in shell's first Tab stop, off screen until the keyboard's Tab
   gives it focus, then over the app bar's corner. Focus a script puts there - a dialog closing hands focus back to what had
   it - leaves it off screen: wwwroot/js/skipLink.js marks it, and a phone showed it over the header after a dialog closed
   (GitHub #322). It moves focus to the page's main landmark, which - like the page title - is not a control and takes
   focus without a ring. */
.skip-link {
    position: fixed;
    top: 8px;
    left: 8px;
    z-index: calc(var(--mud-zindex-appbar) + 1);
    transform: translateY(calc(-100% - 16px));
}

.skip-link:focus-visible:not([data-out-of-sight]) {
    transform: none;
}

.app-main:focus,
.app-main:focus-visible {
    outline: none;
}

/* A whole row that is one link (the document list). MudBlazor's list is a selection list (role=option),
   which would hide that each row navigates; a MudLink per row keeps link semantics and gets the same
   hover tint MudBlazor uses for its own clickable rows. */
.row-link {
    transition: background-color 150ms ease-out;
}

.row-link:hover {
    background-color: var(--mud-palette-action-default-hover);
}

/* A card that is one target (owner, 2026-11-26: "clicking the card itself doesn't do anything"): the Templates page's cards
   and presets, and a shared link's row. Its one link or button - the card's title, Copy to change it, Use this, the sheet's
   name - keeps its place and its name, and its ::after stretches over the whole card, so a click anywhere on the card is a
   click on it and a keyboard meets one stop, never a link nested in another. A control of its own on the card (its menu)
   is lifted above the cover. A button's own position: relative (MudBlazor's .mud-button-root) would hold the cover inside
   the button, so it is made static; the card tints under the pointer like a whole-row link, and a keyboard's focus rings
   the whole card rather than its title (the ring is :root's, at its strength and above, so MudBlazor's own clearing
   loses). */
.card-link-host {
    position: relative;
    cursor: pointer;
    transition: background-color 150ms ease-out;
}

.card-link-host:hover {
    background-color: var(--mud-palette-action-default-hover);
}

.card-link-host .card-link {
    position: static;
}

.card-link-host .card-link::after {
    content: "";
    position: absolute;
    inset: 0;
}

.card-link-host .card-above-link {
    position: relative;
    z-index: 1;
}

/* A list row's title link, 44 px tall under a finger and no taller on the page (GitHub #572; tools/browser-review/touch-targets.mjs
   measures a link by its own box, which was its 22 px line though its cover already made the row one target). Padding makes the
   box 44 px and an equal negative margin gives the height back, so the row looks and measures as before. Desktop keeps the tight
   one-line row. It is the touch rule the rest of this file uses (GitHub #633): a finger is a finger at any width - a tablet, a phone
   held sideways - and a window as narrow as a phone's counts too, whatever its pointer; a mouse on a wide window keeps the row. */
@media (pointer: coarse), (max-width: 599.98px) {
    .card-link-host .card-link.card-link-touch {
        padding-block: 11px;
        margin-block: -11px;
    }

    @supports (height: 1lh) {
        .card-link-host .card-link.card-link-touch {
            padding-block: calc((44px - 1lh) / 2);
            margin-block: calc((1lh - 44px) / 2);
        }
    }
}

:root .card-link-host:has(.card-link:focus-visible) {
    outline: 2px solid var(--speccapture-highlight);
    outline-offset: 2px;
}

:root .card-link-host .card-link:focus-visible {
    outline: none;
}

/* A row of a list that is one target (the Shared links list): its ring sits just inside, where the list's edge would cut
   one drawn outside it off. */
:root .card-link-host--row:has(.card-link:focus-visible) {
    outline-offset: -2px;
}

/* A row's leading icon - MudAvatar, outlined: a template, an API key, a person, a link, a webhook - pictures the row. A
   ring round it read as a round button where the row does nothing (owner, 2026-11-26: "all the things that look like
   buttons"), so it has none: a soft disc behind the icon, which keeps its colour. As strong as MudBlazor's own coloured
   rings and loaded after them, so it wins. */
.mud-avatar.mud-avatar-outlined {
    border-color: transparent;
    background-color: var(--mud-palette-action-default-hover);
}

/* A few short facts, an icon and a few words each, on one wrapping line (IconFacts): the browser's list without its bullets. */
.icon-facts {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 4px 20px;
    color: var(--mud-palette-text-secondary);
}

.icon-fact {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
    overflow-wrap: anywhere;
}

.icon-fact .mud-icon-root {
    flex-shrink: 0;
}

/* Long unbroken text (a file name, a part number with no spaces) wraps instead of pushing the page
   sideways on a phone. */
.break-anywhere {
    overflow-wrap: anywhere;
    min-width: 0;
}

/* The page header's row (PageHeader): the title keeps at least 20rem (or the whole row, on a narrower phone) and takes
   whatever the actions leave; when both do not fit on one row the actions wrap beneath the title, so a long file name
   with no spaces breaks only where it must at the width it really has. ActionsBesideTitle (a lone small menu button,
   GitHub #542) never wraps: the button stays on the title's row. */
.page-header-row {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}

.page-header-title {
    flex: 1 1 20rem;
    min-width: min(20rem, 100%);
}

.page-header-actions {
    flex: 0 1 auto;
    min-width: 0;
}

.page-header-row-beside {
    flex-wrap: nowrap;
}

.page-header-row-beside .page-header-title {
    flex-basis: 0;
    min-width: 0;
}

.page-header-row-beside .page-header-actions {
    flex-shrink: 0;
}

/* A button's label is never broken mid-word, even inside text that may be: a squeezed button keeps its longest word whole
   instead (GitHub #528: "Open" read "Ope" / "n" beside a wide field). */
.break-anywhere .mud-button-root {
    overflow-wrap: normal;
}

/* Text a person copies into a terminal or a config file - an API key, its prefix, an example request - in the
   system's monospace face, so look-alike characters (l, 1, I, 0, O) stay distinct. MudBlazor has no code style. */
.code-text,
.code-text .mud-input {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
}

/* A short list inside running text - the events an endpoint receives, the steps to check a signature: the browser's
   own bullets or numbers, indented to sit under the sentence that introduces them. MudBlazor's MudList is for
   interactive lists, not prose. */
.text-list {
    margin: 0;
    padding-left: 1.5rem;
}

.text-list > li + li {
    margin-top: 4px;
}

/* An example request: a block that keeps its lines exactly as they are to be typed - an address broken in the
   middle reads as two - and scrolls sideways on its own when a line is wider than a phone, never the page.
   Theme variables only, so it reads in both palettes. */
.code-sample {
    margin: 0;
    max-width: 100%;
    overflow-x: auto;
    padding: 12px 16px;
    border: 1px solid var(--mud-palette-lines-default);
    border-radius: var(--mud-default-borderradius);
    background-color: var(--mud-palette-background-gray);
    color: var(--mud-palette-text-primary);
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
    font-size: 0.8125rem;
    line-height: 1.6;
    white-space: pre;
}

/* Subtle entrance for page content: a short rise and fade, skipped for anyone who asks for less motion. */
@media (prefers-reduced-motion: no-preference) {
    .fade-in {
        animation: speccapture-rise 0.24s ease-out both;
    }
}

@keyframes speccapture-rise {
    from {
        opacity: 0;
        transform: translateY(6px);
    }

    to {
        opacity: 1;
        transform: none;
    }
}

/* The component gallery's preview frames: a frame is a real page, so a phone-width frame trips the same
   breakpoints a phone would. */
.preview-frame {
    display: block;
    width: 100%;
    border: 0;
}

/* A state's label in the gallery is a sentence, so its chip wraps to the page's width and grows to its lines, rather than running
   off a phone's edge on one line and widening the page (GitHub #589). */
.mud-chip.gallery-state-chip {
    height: auto;
    min-height: 24px;
    max-width: 100%;
    white-space: normal;
    text-align: start;
}

.gallery-state-chip .mud-chip-content {
    white-space: normal;
    overflow-wrap: anywhere;
    padding-block: 2px;
}

/* The page inside a gallery frame (Admin/Gallery/PreviewFramePage) has no app bar: what sticks under it - a work screen's
   header - sticks to the very top there, rather than 64 px down over the screen it heads (GitHub #239). */
.preview-frame-page {
    --mud-appbar-height: 0px;
}

/* The upload drop zone. Its edge, hover and focus tint are MudBlazor's own drag-area classes
   (mud-file-upload-dragarea); this only gives it room to be an easy target for a thumb, the tint while a
   file is held over it, and the "choose a file" words their link look. */
.upload-zone {
    min-height: 13rem;
    width: 100%;
    color: inherit;
    font: inherit;
}

/* A phone's zone is a line of text and a picture, not a screen's worth of empty box (GitHub #509). */
@media (max-width: 599.98px) {
    .upload-zone {
        min-height: 10rem;
    }
}

.upload-zone-dragging {
    background-color: var(--mud-palette-action-default-hover);
}

.upload-zone-link {
    font-weight: 600;
    text-decoration: underline;
    text-underline-offset: 3px;
}

/* The export-control sentence is three lines on a phone: its box sits by the first line, not the middle. */
.export-control-statement .mud-checkbox {
    align-items: flex-start;
}

/* The sign-in page's "This is a shared computer" choice: the whole label is the tap target (a phone shows it on two lines), at
   least 44 px tall, with the box by the first line (GitHub #558). */
.sign-in-shared-computer {
    align-items: flex-start;
    min-height: 44px;
}

/* The review screen's keyboard shortcuts panel (Features/Review/ShortcutsHelp; it renders in the popover layer, outside any
   component's scoped styles). It hangs from a zero-height anchor under the screen's header, right-aligned, so it covers only
   the selected value's panel - never under 300 px wide (GitHub #282 item 19) - and no more of the window's height than
   leaves its foot clear of the bottom: the list scrolls inside it. Its width is set on the content, because MudBlazor's
   popover script writes max-width: none on the popover itself. Compact: tight rows, small keycaps drawn in the theme's own
   lines and text colours. */
.shortcuts-anchor {
    position: relative;
    height: 0;
}

.shortcuts-panel {
    position: relative;
    width: min(300px, calc(100vw - 32px));
}

.shortcuts-heading {
    padding: 10px 44px 2px 12px;
}

.shortcuts-close {
    position: absolute;
    top: 4px;
    right: 4px;
}

.shortcuts-switch {
    padding: 0 12px 6px 6px;
    border-bottom: 1px solid var(--mud-palette-lines-default);
}

.shortcuts-switch-label {
    margin-left: 4px;
    font-size: 0.875rem;
}

.shortcuts-note {
    padding-left: 6px;
    line-height: 1.4;
}

.shortcuts-body {
    max-height: max(160px, calc(100dvh - 345px));
    overflow-y: auto;
    padding: 0 12px 10px;
}

.shortcuts-body:focus-visible {
    outline: 2px solid var(--mud-palette-primary);
    outline-offset: -2px;
}

/* A group the single-key switch turned off reads as not now (GitHub #212); its heading says "(off)" in words. */
.shortcuts-table--off td,
.shortcuts-table--off kbd {
    color: var(--mud-palette-text-disabled);
}

.shortcuts-group {
    margin-top: 6px;
    line-height: 2;
}

.shortcuts-table {
    width: 100%;
    border-collapse: collapse;
}

.shortcuts-table td {
    padding: 2px 0;
    vertical-align: top;
    font-size: 0.8125rem;
    line-height: 1.35;
}

.shortcuts-table td.shortcuts-keys {
    width: 1%;
    padding-right: 8px;
    white-space: nowrap;
}

/* One width for the keys of every group but the drawing's arrows, so the descriptions start in one line down the panel. */
.shortcuts-keycaps {
    display: inline-block;
    min-width: 54px;
}

.shortcuts-table kbd {
    display: inline-block;
    min-width: 1.5em;
    margin-right: 3px;
    padding: 0 5px;
    border: 1px solid var(--mud-palette-lines-default);
    border-bottom-width: 2px;
    border-radius: 4px;
    font-family: var(--mud-typography-default-family);
    font-size: 0.75rem;
    line-height: 1.45;
    text-align: center;
    color: var(--mud-palette-text-primary);
    background-color: var(--mud-palette-background);
}

/* A phone with a keyboard (? opens it): its Close is a full touch target, and its foot clears the bottom under the phone's
   taller header. */
@media (max-width: 599.98px) {
    .shortcuts-heading {
        padding-top: 14px;
        padding-right: 52px;
    }

    .shortcuts-body {
        max-height: max(160px, calc(100dvh - 500px));
    }

    .shortcuts-close {
        min-width: 44px;
        min-height: 44px;
    }
}

/* The "delayed" banner spans the content area edge to edge, above the page. */
.processing-delay {
    border-radius: 0;
}

/* The account button: one real MudButton (GitHub #65, #79) drawn as the person's initials in a circle, as a MudAvatar
   would draw them - a 44 px touch target. Its wrapper is the panel's anchor, the button's own size. */
.account-menu {
    display: inline-flex;
    position: relative;
}

.account-menu .account-menu-button {
    width: 44px;
    min-width: 44px;
    height: 44px;
    padding: 0;
    border-radius: 50%;
    font-size: 1rem;
    letter-spacing: 0;
}

/* The account panel (GitHub #79): one width wherever it is drawn, never wider than a phone's screen less its gutters.
   Under the app bar it scrolls inside itself when the screen is too short for it (a phone held sideways). */
.account-panel {
    width: 20rem;
    max-width: calc(100vw - 32px);
}

.account-popover {
    max-height: calc(100vh - var(--mud-appbar-height) - 16px);
    max-height: calc(100dvh - var(--mud-appbar-height) - 16px);
    overflow-y: auto;
}

/* The gallery's still picture of the panel, on the raised surface its popover gives it. */
.account-surface {
    background-color: var(--speccapture-surface-raised);
}

/* The gallery's phone frame: a real 360-pixel page inside a device-like border drawn in the theme's lines. */
.phone-frame {
    display: inline-block;
    max-width: 100%;
    padding: 10px;
    border: 1px solid var(--mud-palette-lines-default);
    border-radius: 28px;
    background-color: var(--mud-palette-background);
}

/* How much of the top of the page the fixed app bar covers, for what sticks below it as the page scrolls: the review
   screen's section headings (ReviewViewerLibrary's FieldList reads --field-list-page-top). The app bar's own height, by
   the same rules MudBlazor uses for the main content's top padding: 7/8 of the theme's height on a phone held upright,
   3/4 turned sideways, the full height from 600 px up. A page without the app bar (the gallery's frames) leaves it
   unset, and the headings stick to the very top. */
.mud-main-content {
    --field-list-page-top: calc(var(--mud-appbar-height) - var(--mud-appbar-height) / 8);
}

@media (orientation: landscape) {
    .mud-main-content {
        --field-list-page-top: calc(var(--mud-appbar-height) - var(--mud-appbar-height) / 4);
    }
}

@media (min-width: 600px) {
    .mud-main-content {
        --field-list-page-top: var(--mud-appbar-height);
    }
}

/* No control the keyboard reaches ends under a bar that stays on the screen (GitHub #213, WCAG 2.4.11). Each such bar says
   which edge it sticks to (data-sticky-bar: the app bar, the review screen's progress bar, the builder's publish bar, the
   Documents page's selection bar), and wwwroot/js/stickyBars.js measures how far into the screen they reach from the top
   and from the bottom. Those lengths are the page's scroll padding, with a little air for the focus ring, so the browser
   brings a focused control into view between the bars rather than under one. Until the script has measured, the top is
   the app bar's height. */
html {
    scroll-padding-top: calc(var(--sticky-bars-top-height, var(--mud-appbar-height)) + 8px);
    scroll-padding-bottom: calc(var(--sticky-bars-bottom-height, 0px) + 8px);
}

/* The review screen's Undo pinned to a phone's foot under its list (GitHub #591) is not one of those bars - counted among them it
   would tip a short phone's bars over a third of the screen and unstick the header - so the page keeps room for it itself. */
html:has(.review-undo-foot) {
    scroll-padding-bottom: calc(var(--sticky-bars-bottom-height, 0px) + 60px);
}

/* Where the bars would take more than a third of the screen - a short window, or 200% to 400% zoom - they stop sticking
   (the script sets data-sticky-bars="off", and both lengths above to 0): each scrolls with the page from its own place,
   and the page gets the whole screen. The app bar keeps its place at the top of the page, which already starts below it,
   and the review screen's section headings, which stuck under it, stick to the very top. */
:root[data-sticky-bars="off"] body [data-sticky-bar] {
    position: static;
}

:root[data-sticky-bars="off"] body .mud-appbar[data-sticky-bar] {
    position: absolute;
}

:root[data-sticky-bars="off"] .mud-main-content {
    --field-list-page-top: 0px;
}

/* The review screen's rail (a mini drawer): folded, icons only; opened (the pointer resting on it, focus inside it, or
   the menu button), the icons with their names. Opening and folding it is one change of width - MudBlazor's own 225 ms
   transition - and nothing else moves (GitHub #155): every icon keeps one place in both states, the names come in beside
   them on one line, fading in as the rail's edge slides past, and every section heading (Work, Set up, Workspace, Admin:
   GitHub #166) keeps its height folded, so the icons below it never move up or down - the empty band where a heading
   was is what groups the folded rail's icons. Folding, the names and the headings go at once (MudBlazor hides a folded
   rail's names for all but a screen reader), and nothing lingers while the rail narrows. Nothing scrolls sideways while
   the width changes. The folded rail's width inside its right-hand border (AppShell's border-r, 1px) is the one length both
   states place the icons by, below. */
/* How many drawings were sent to the person for review (GitHub #316): a small count beside Review's name, in the theme's
   own colours; on a folded rail, where names fade, a dot on its icon says the same. */
.nav-link-label {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.nav-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 20px;
    padding: 0 6px 0 3px;
    gap: 1px;
    border-radius: 10px;
    font-size: 0.75rem;
    font-weight: 600;
    line-height: 1;
    background-color: var(--mud-palette-primary);
    color: var(--mud-palette-primary-text);
}

/* The person-pin glyph says the count is "drawings with me", as Assigned to you on the page does (#493). */
.nav-count .mud-icon-root {
    width: 14px;
    height: 14px;
    font-size: 14px;
}

.nav-link-counted .mud-nav-link {
    position: relative;
}

.mud-drawer-mini.mud-drawer--closed .nav-link-counted .mud-nav-link::after {
    content: "";
    position: absolute;
    top: 8px;
    inset-inline-start: calc((var(--folded-rail-inner-width) - 1rem) / 2 + 0.75rem);
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: var(--mud-palette-primary);
}

.mud-drawer-mini {
    overflow-x: hidden;
    --folded-rail-inner-width: calc(var(--mud-drawer-width-mini-left) - 1px);
}

.mud-drawer-mini .nav-section-heading,
.mud-drawer-mini .mud-nav-link-text {
    white-space: nowrap;
}

.mud-drawer-mini.mud-drawer--closed .nav-section-heading,
.mud-drawer-mini.mud-drawer--closed .mud-nav-link-text {
    opacity: 0;
}

.mud-drawer-mini.mud-drawer--open .nav-section-heading,
.mud-drawer-mini.mud-drawer--open .mud-nav-link-text {
    transition: opacity 150ms ease;
}

/* Folded, each icon sits on the rail's centre line (GitHub #109). MudBlazor's 16 px link padding centres a 24 px icon
   in its 56 px rail only when the links reach the rail's edges; the menu's own gutter (NavMenu's pa-2) keeps them 8 px
   in from each side, which put every icon 8.5 px right of centre, hard against the right edge of its highlight and its
   focus ring. Half the link's width less half the icon's puts the icon in the middle of the link, and so of the rail,
   whatever the rail's width or the gutter's, so long as the gutter is the same on both sides. */
.mud-drawer-mini.mud-drawer--closed .mud-nav-link {
    padding-inline-start: calc(50% - 0.75rem);
}

/* ...and it stays there while the rail is still narrowing: folded, the menu is the folded rail's width at once, so the
   half above is half of a folded link however wide the rail still is (GitHub #155). */
.mud-drawer-mini.mud-drawer--closed > .mud-drawer-content > .mud-navmenu {
    width: var(--folded-rail-inner-width);
}

/* Opened, each icon stays exactly where it was folded (GitHub #155): half a folded link - the folded rail's width less
   the menu's gutter on both sides (NavMenu's pa-2, 0.5rem) - less half the icon, the same length the rule above comes
   to. The names start beside the icons, and nothing animates the padding: MudBlazor eases a link's padding, which slid
   every icon sideways and back as the rail opened and folded. */
.mud-drawer-mini.mud-drawer--open .mud-nav-link {
    padding-inline-start: calc((var(--folded-rail-inner-width) - 1rem) / 2 - 0.75rem);
}

.mud-drawer-mini .mud-nav-link {
    transition-property: background-color, box-shadow, border;
}

.phone-frame iframe {
    display: block;
    width: 360px;
    max-width: calc(100vw - 72px);
    border: 0;
    border-radius: 18px;
    background-color: var(--mud-palette-background);
}

/* The gallery's screen frame (Admin/Gallery/ScreenFrame, GitHub #239): a laptop's or a monitor's window drawn smaller - its
   page laid out at the window's full size, then scaled - inside a border in the theme's lines. Never wider than the column. */
.screen-frame {
    box-sizing: content-box;
    max-width: 100%;
    overflow: hidden;
    border: 1px solid var(--mud-palette-lines-default);
    border-radius: var(--mud-default-borderradius);
    background-color: var(--mud-palette-background);
}

.screen-frame iframe {
    display: block;
    border: 0;
    transform-origin: 0 0;
    background-color: var(--mud-palette-background);
}

/* The guided tour (Shared/Guidance/GuidedTour.razor). MudOverlay blocks the page and MudPopover places the card;
   the one thing MudBlazor has no piece for is the spotlight: the part of the screen a step is about, left clear
   while everything around it is dimmed. It is a rectangle over that part whose shadow, in the theme's own overlay
   colour, covers the rest of the screen; its outline is the theme's highlight (the focus-ring colour, 3:1 against
   every surface in both palettes). It never takes a click: the page underneath is only shown, not used. Its place
   is written by wwwroot/js/guidedTour.js, which keeps it on its target; until then it is a point at the centre. */
.guided-tour-spotlight {
    position: fixed;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: var(--mud-default-borderradius);
    box-shadow: 0 0 0 200vmax var(--mud-palette-overlay-dark);
    outline: 3px solid var(--speccapture-highlight);
    outline-offset: 0;
    pointer-events: none;
}

.guided-tour-spotlight[data-target="none"] {
    outline: none;
}

@media (prefers-reduced-motion: no-preference) {
    .guided-tour-spotlight {
        transition: top 0.25s ease-out, left 0.25s ease-out, width 0.25s ease-out, height 0.25s ease-out;
    }
}

/* The step's card: beside its target from tablet width up, a little apart from it. */
.guided-tour-popover {
    width: min(380px, calc(100vw - 32px));
}

.guided-tour-popover.guided-tour-below {
    margin-top: 12px;
}

.guided-tour-popover.guided-tour-above {
    margin-top: -12px;
}

.guided-tour-popover.guided-tour-inside {
    margin-top: -16px;
}

/* On a phone the card sits at the bottom of the screen, where a thumb is, clear of the home indicator. */
.guided-tour-sheet {
    position: fixed;
    left: 8px;
    right: 8px;
    bottom: calc(8px + env(safe-area-inset-bottom));
    background-color: var(--speccapture-surface-raised);
}

.guided-tour-card {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 4px 16px 12px;
}

.guided-tour-progress {
    margin: 8px 0 2px;
}

.guided-tour-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-right: -8px;
}

.guided-tour-keys {
    display: flex;
    align-items: center;
    gap: 6px;
}

.guided-tour-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin-top: 6px;
}

/* The export menu's note while a drawing is still being read: a narrow empty state inside the menu. */
.export-menu-note {
    max-width: min(320px, calc(100vw - 32px));
}

/* A menu's words when it has nothing to choose (MenuNote, GitHub #185): focused as the menu opens so the keyboard is
   inside the menu, it is not a control, and like the page's main landmark it takes focus without a ring. */
.menu-note:focus,
.menu-note:focus-visible {
    outline: none;
}

/* The Documents page's selection bar (GitHub #142): its Export button stays in sight under the app bar while a person
   scrolls the list ticking documents - on a phone the bar is far above the rows. The page's own surface, in both
   palettes. Its box and words keep to one line beside each other and wrap as a pair before the buttons do. */
.documents-selection-bar {
    position: sticky;
    top: calc(var(--mud-appbar-height) + 8px);
    z-index: 2;
    background-color: var(--mud-palette-surface);
}

.documents-selection-what {
    flex: 1 1 240px;
}

/* From 960 px the preview sits beside the editor and stays in sight as the editor scrolls. */
@media (min-width: 960px) {
    .template-preview-pane {
        position: sticky;
        top: calc(var(--mud-appbar-height) + 132px);
        max-height: calc(100dvh - var(--mud-appbar-height) - 148px);
        overflow-y: auto;
    }
}

/* An export file's heading row in the builder's preview (GitHub #177): each heading on one line, as a spreadsheet's
   column heading reads; the row scrolls sideways inside its own box. */
.template-export-heading {
    white-space: nowrap;
}

/* The builder's example files (GitHub #243): the JSON and a CSV file exactly as written, in a box that scrolls both ways
   rather than running the pane long - MudBlazor has no code view - and a workbook cell shaded as the file shades it,
   amber while it waits for a person and blue for a correction, from the theme's own warning and info colours so it reads
   in both palettes. */
.code-sample--tall {
    max-height: 22rem;
    overflow: auto;
}

.template-export-cell--waiting {
    background-color: rgba(var(--mud-palette-warning-rgb), 0.22);
}

.template-export-cell--corrected {
    background-color: rgba(var(--mud-palette-info-rgb), 0.22);
}

/* Why each amber cell waits (GitHub #278): a line each under the tab's rows, the cell's heading shaded as the cell is. */
.template-export-waits {
    margin: 2px 0 0;
    padding-left: 1.25rem;
}

.template-export-wait-where {
    padding: 0 4px;
    border-radius: 2px;
}

/* A box wider content scrolls sideways in, which the keyboard reaches (ScrollRegion, GitHub #216, WCAG 2.1.1): a named
   region with tabindex="0", so Tab stops on it and the arrow keys scroll it. The box is what scrolls - MudBlazor's table
   container inside it would otherwise scroll (overflow-y makes it a scroller), and nothing can focus that - and the
   table inside is as wide as its columns, its outline round every one of them. */
.scroll-region {
    max-width: 100%;
    overflow-x: auto;
}

.scroll-region > .mud-table {
    width: max-content;
    min-width: 100%;
}

.scroll-region > .mud-table > .mud-table-container {
    overflow: visible;
}

/* A list put in order by dragging (Shared/Work/ReorderGroup, wwwroot/js/reorder.js, GitHub #535). Nothing in the list moves
   while a row is held. The row held stays where it was, dimmed and tinted as the empty slot it left; a chip with only its
   name rides the pointer's height along the list's right-hand edge, so it covers none of the words being passed over; and a
   line in the primary colour, with a dot at its start, sits on the border where the row will land - always between rows,
   never through one's words. Theme tokens only, legible in both palettes. */
.reorder-group {
    position: relative;
}

.reorder-item--lifted {
    background-color: var(--mud-palette-action-default-hover);
}

.reorder-item--lifted > * {
    opacity: 0.4;
}

.reorder-line {
    position: absolute;
    inset-inline: 0;
    top: 0;
    height: 0;
    border-top: 3px solid var(--mud-palette-primary);
    border-radius: 2px;
    z-index: 4;
    pointer-events: none;
    display: none;
    transform: translateY(-1.5px);
}

.reorder-line::before {
    content: "";
    position: absolute;
    inset-inline-start: 0;
    top: -6px;
    width: 9px;
    height: 9px;
    box-sizing: border-box;
    border-radius: 50%;
    background-color: var(--mud-palette-surface);
    border: 3px solid var(--mud-palette-primary);
}

.reorder-line[data-shown="true"] {
    display: block;
}

.reorder-chip {
    position: fixed;
    top: 0;
    z-index: var(--mud-zindex-popover, 1200);
    max-width: min(60vw, 280px);
    padding: 6px 12px;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    font: inherit;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--mud-palette-text-primary);
    background-color: var(--mud-palette-surface);
    border: 1px solid var(--mud-palette-primary);
    border-radius: var(--mud-default-borderradius, 4px);
    box-shadow: var(--mud-elevation-8);
    opacity: 0.94;
    pointer-events: none;
    transition: opacity 120ms ease-out;
}

.reorder-chip--gone {
    opacity: 0;
}

/* While a row is held, the whole page shows the grabbing hand and selects no text, and a hover lights nothing. */
html.reorder-dragging,
html.reorder-dragging * {
    cursor: grabbing !important;
    -webkit-user-select: none;
    user-select: none;
}

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

.template-field-keep {
    margin: -10px 0 !important;
}

/* ---- Work screens: the template builder, and the review screen after it (GitHub #275, #281) ------------------------ */

/* One row of a list of fields (Shared/Work/ValueRow): its name the one control, the whole row a tap target. The name's
   button is MudBlazor's, laid flat: left-aligned, as wide as its text, with the row's own padding. A selected row takes
   the theme's selection tint and a bar of the primary colour at its start edge, in both palettes. */
.value-row {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 4px 12px;
    cursor: pointer;
    border-inline-start: 3px solid transparent;
    min-width: 0;
}

.value-row:hover {
    background-color: var(--mud-palette-action-default-hover);
}

.value-row--selected,
.value-row--selected:hover {
    background-color: var(--mud-palette-action-default-hover);
    border-inline-start-color: var(--mud-palette-primary);
}

.value-row-lead,
.value-row-trail {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    min-height: 24px;
}

.value-row-body {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-width: 0;
}

.value-row-head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 2px 6px;
    min-width: 0;
}

/* Compact (GitHub #295): a row's name is a line of text, not a button's height - the whole row is the tap target, and on
   a touch screen the row itself is never less than 44 px tall. */
.mud-button-root.value-row-name {
    padding: 1px 0;
    min-height: 0;
    line-height: 1.4;
    min-width: 0;
    justify-content: flex-start;
    text-align: start;
    text-transform: none;
    font-weight: 600;
    letter-spacing: normal;
    max-width: 100%;
    overflow-wrap: anywhere;
    white-space: normal;
}

.mud-button-root.value-row-name:hover {
    background-color: transparent;
}

.value-row-badges {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 4px;
}

.value-row-value {
    display: block;
    line-height: 1.4;
}

@media (pointer: coarse) {
    .value-row {
        min-height: 44px;
    }
}

/* The chips a field carries in a list (Shared/Work/FieldBadge): a line of small type, not a control's height. */
.mud-chip.field-badge {
    height: 20px;
    padding: 0 6px;
    font-size: 0.75rem;
}

.mud-chip.field-badge .mud-chip-icon {
    font-size: 0.875rem;
    margin-inline-end: 3px;
}

/* Measured is a mark, not a chip (GitHub #495): the size of a chip's line, nothing to press. */
.field-badge-mark.mud-icon-root {
    font-size: 1.125rem;
    vertical-align: middle;
}

/* "Read with <template>" (GitHub #24, #386): a template's name can be long, and a chip keeps its words on one line, so on a
   phone it ran off the screen's right-hand edge (GitHub #470). Its words wrap inside it instead, its height following its
   lines; the tap target's minimum above still holds. So does a review link's "With <reviewer>" or "Sent to <whom>" on a
   Review home row (GitHub #474): a reviewer is named with the email they gave when two gave one name, and a phone cut it off. */
.mud-chip.read-with-chip,
.mud-chip.review-link-chip {
    height: auto;
    padding-block: 3px;
    white-space: normal;
}

.mud-chip.read-with-chip .mud-chip-content,
.mud-chip.review-link-chip .mud-chip-content {
    min-width: 0;
    overflow-wrap: anywhere;
    text-align: start;
}

.value-row-note {
    display: block;
}

/* A field's grip in the builder's list (GitHub #291): the one place a drag starts, so a swipe anywhere else on a row
   scrolls. As big as a fingertip - 40 px square - with negative margins so the row keeps its height and the grip sits in
   the row's own start padding. The browser does not scroll or zoom from it: a finger on it moves the field. */
.template-row-grip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    margin: -6px -8px -6px -12px;
    cursor: grab;
    touch-action: none;
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
}

.template-row-grip:active {
    cursor: grabbing;
}

/* With a finger the grip is 44 px, the least a touch target is (GitHub #535), the row's height still unchanged. */
@media (pointer: coarse) {
    .template-row-grip {
        width: 44px;
        height: 44px;
        margin: -8px -10px -8px -14px;
    }
}

/* The selected thing's panel (Shared/Work/PanelShell). From 960 px a panel in its place: its heading and its foot stay in
   sight and its body scrolls, the whole no taller than the screen under the app bar. Below 960 px a sheet from the bottom
   edge, as the builder's field sheet (#176) is drawn. */
.panel-shell--side {
    display: flex;
    flex-direction: column;
    max-height: calc(100dvh - var(--mud-appbar-height) - 24px);
    position: sticky;
    top: calc(var(--mud-appbar-height) + 12px);
    overflow: hidden;
}

.panel-shell-head {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 8px 8px 6px 12px;
    border-bottom: 1px solid var(--mud-palette-lines-default);
}

/* Its Close is a small icon button, a mouse's size; without a fine pointer - a phone, where a sheet with no drawing kept puts
   the review screen's panel in the list's place (GitHub #393), a tablet - it is a 44 px target like every other control. */
@media not all and (pointer: fine) {
    .panel-shell-head .mud-icon-button {
        min-width: 44px;
        min-height: 44px;
    }
}

.panel-shell-titles {
    display: flex;
    flex-direction: column;
    gap: 2px;
    flex: 1 1 auto;
    min-width: 0;
}

.panel-shell-body {
    flex: 1 1 auto;
    overflow-y: auto;
    padding: 8px 12px;
}

.panel-shell-foot {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    padding: 4px 12px;
    border-top: 1px solid var(--mud-palette-lines-default);
}

.mud-dialog.work-sheet {
    width: 100%;
    max-width: 600px;
    margin: 0 !important;
    max-height: calc(100dvh - 48px);
    padding-bottom: env(safe-area-inset-bottom, 0px);
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
}

.mud-dialog.work-sheet .mud-dialog-content {
    overflow-y: auto;
}

.mud-dialog-container:has(> .mud-dialog.work-sheet) {
    padding-bottom: 0;
}

/* A work screen's header row (Shared/Work/WorkHeader): the way back, the name and where it stands, the actions - one row
   from 600 px, and on a phone the actions on a row of their own under the name. It stays in sight under the app bar, on
   the page's own surface in both palettes. */
.work-header-bar {
    position: sticky;
    top: var(--mud-appbar-height);
    z-index: 3;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px 12px;
    padding: 4px 0;
    margin-bottom: 4px;
    background-color: var(--mud-palette-background);
    border-bottom: 1px solid var(--mud-palette-lines-default);
}

.work-header-titles {
    flex: 1 1 200px;
    min-width: 0;
}

.work-header-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px 8px;
}

/* The 8 px between the app bar and the sticky header (the page's top padding is what the header's offset leaves above it) is covered
   in the page's colour below 960 px, so a phone's scrolling content never shows through it as a half line (GitHub #562). */
@media (max-width: 959.98px) {
    .work-header-bar::before {
        content: "";
        position: absolute;
        left: 0;
        right: 0;
        top: -8px;
        height: 8px;
        background-color: var(--mud-palette-background);
        pointer-events: none;
    }
}

/* A row of the screen's own inside the sticky bar, under the rest (WorkHeader's Below, GitHub #562): the review screen's tabs
   on a phone. As wide as the bar; part of it, so it sticks with it and is never under it. */
.work-header-below {
    flex: 1 1 100%;
    min-width: 0;
}

@media (max-width: 599.98px) {
    .work-header-actions {
        flex: 1 1 100%;
        justify-content: flex-end;
    }
}

/* One row on a phone, for a screen that asks for it (GitHub #530): the way back, the name and the actions share the first row and
   where the thing stands is the line under it. The titles' box dissolves so its two parts take their places in the header's
   own wrapping row; the screen keeps only its main action and its menu in the row, the rest being in the menu. */
@media (max-width: 599.98px) {
    .work-header-bar--one-row .work-header-titles {
        display: contents;
    }

    .work-header-bar--one-row .work-header-title-row {
        flex: 1 1 0;
        min-width: 0;
        order: 1;
    }

    .work-header-bar--one-row .work-header-actions {
        flex: 0 0 auto;
        order: 2;
    }

    .work-header-bar--one-row .work-header-status {
        flex: 1 1 100%;
        order: 3;
    }

    /* A screen's own row inside the bar (Below, GitHub #562) comes last of all. */
    .work-header-bar--one-row .work-header-below {
        order: 4;
    }
}

/* From 960 px the header is one line wherever it fits (GitHub #239): where the thing stands follows its name and chips on
   their line, and goes under them only when there is no room; with a mouse its icon buttons are the compact 36 px the other
   buttons are (GitHub #295), so they set no taller line than the name. A touch screen keeps 48 px. */
@media (min-width: 960px) {
    .work-header-titles {
        display: flex;
        flex-wrap: wrap;
        align-items: baseline;
        column-gap: 12px;
    }
}

@media (min-width: 960px) and (pointer: fine) {
    .work-header-bar .mud-icon-button {
        padding: 6px;
    }
}

/* Which view a work screen shows (Shared/Work/WorkViewSwitch): the screen's width on a phone, its words' width from 600 px. */
.work-view-switch {
    width: 100%;
}

.work-view-switch .mud-toggle-item {
    flex: 1 1 0;
}

@media (min-width: 600px) {
    .work-view-switch {
        width: auto;
    }

    .work-view-switch .mud-toggle-item {
        flex: 0 0 auto;
        min-width: 112px;
    }
}

/* A view's count beside its words ("Fields 8"): the item's own colour, a little quieter, so it reads on the chosen item too. */
.work-view-count {
    opacity: 0.72;
    font-weight: 400;
}

/* A work screen's panes (Shared/Work/WorkPanes, GitHub #292): one column on a phone, where the screen chooses which pane
   it shows and the page scrolls; from 960 px side by side, each its share of the width and never narrower than its least
   (--work-panes-columns, from the panes), all of them as tall as the screen under its sticky bars (--work-panes-height,
   measured by wwwroot/js/workPanes.js), each scrolling on its own - so a long list scrolls in its pane while the drawing
   and the panel beside it stay in sight. A pane whose content scrolls itself (a panel with its heading and foot) is given
   the whole height and does not scroll. A pane not shown keeps what it holds and takes no room. */
.work-panes {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 16px;
    align-items: start;
}

/* What the page keeps free under a work screen's panes (wwwroot/js/workPanes.js reads it): its own padding below them. From
   960 px a work screen's page has 4 px there (AppShell), so the panes - the drawing, the panel and its foot - reach down to the
   foot of the screen (GitHub #239); below 960 px, the 16 px they always had. */
[data-full-width] {
    --work-panes-space-below: 16px;
}

@media (min-width: 960px) {
    [data-full-width] {
        --work-panes-space-below: 4px;
    }
}

.work-pane {
    min-width: 0;
}

/* The template builder's field list (GitHub #593): its screen-reader line (position: absolute, at the list's foot) belongs to the
   list, so the pane that scrolls the list clips it with the list. With no positioned parent it belonged to the page, and the
   page grew to the foot of the whole list: a blank half-window of scroll under the builder. */
.template-field-list {
    position: relative;
}

/* Below 960 px the panes stack and there is nothing to drag. */
.work-pane-divider {
    display: none;
}

@media (min-width: 960px) {
    .work-panes {
        grid-template-columns: var(--work-panes-columns, var(--work-panes-default-columns, minmax(0, 1fr)));
        gap: 6px;
        align-items: stretch;
        height: var(--work-panes-height, calc(100dvh - var(--sticky-bars-top-height, 64px) - 120px));
        min-height: var(--work-panes-least-height, 420px);
    }

    .work-pane {
        min-height: 0;
        overflow-y: auto;
        overscroll-behavior: contain;
    }

    .work-pane--fills {
        display: flex;
        flex-direction: column;
        overflow: hidden;
    }

    .work-pane--fills > * {
        min-height: 0;
    }

    .work-pane--hidden {
        display: none;
    }

    /* A side panel in a pane that gives it the whole height: its body scrolls between its heading and its foot. */
    .work-pane--fills .panel-shell--side {
        position: static;
        max-height: 100%;
    }

    /* The divider between two panes (GitHub #293): a hairline in the theme's line colour with a grip at its middle, as
       wide as the gap a person drags in; the primary colour, wider, while a pointer rests on it, it is dragged or it has
       the keyboard's focus. A finger on it moves it rather than scrolling the page. */
    .work-pane-divider {
        display: block;
        position: relative;
        cursor: col-resize;
        touch-action: none;
        outline: none;
        border-radius: var(--mud-default-borderradius);
    }

    .work-pane-divider::before {
        content: "";
        position: absolute;
        top: 0;
        bottom: 0;
        left: 50%;
        width: 1px;
        transform: translateX(-50%);
        background-color: var(--mud-palette-lines-default);
    }

    .work-pane-divider::after {
        content: "";
        position: absolute;
        top: 50%;
        left: 50%;
        width: 6px;
        height: 40px;
        transform: translate(-50%, -50%);
        border-radius: 3px;
        background-color: var(--mud-palette-lines-inputs);
    }

    .work-pane-divider:hover::before,
    .work-pane-divider:focus-visible::before,
    .work-pane-divider--dragging::before {
        width: 3px;
        background-color: var(--mud-palette-primary);
    }

    .work-pane-divider:hover::after,
    .work-pane-divider:focus-visible::after,
    .work-pane-divider--dragging::after {
        background-color: var(--mud-palette-primary);
    }

    .work-pane-divider:focus-visible {
        outline: 2px solid var(--mud-palette-primary);
        outline-offset: 2px;
    }

    /* A finger needs 44 px to land on (GitHub #535): the divider's box grows 16 px into each pane's edge, its drawn line and
       grip staying in the middle of the gap, so it is as easy to take as any button and the layout is the same. */
    @media (pointer: coarse) {
        .work-pane-divider {
            margin-inline: -16px;
            z-index: 2;
        }
    }

    .work-pane-divider--hidden {
        display: none;
    }

    .work-panes--fixed {
        gap: 24px;
    }

    /* While a divider is dragged the panes take no pointer, so the drag never selects their text or wakes a hover. */
    .work-panes--resizing {
        cursor: col-resize;
        user-select: none;
        -webkit-user-select: none;
    }

    .work-panes--resizing > .work-pane {
        pointer-events: none;
    }
}


/* The builder's drawing (GitHub #275 piece 7): the drawing's choice takes the bar's room beside "Test your own fields",
   and a test's found and missed fields are a plain list under it. */
.template-drawing-choice {
    flex: 1 1 14rem;
    min-width: 0;
}

/* MudSelect puts its Class on the input control inside a wrapper of its own, and that wrapper is the bar's flex item: it is
   the one that must be free to shrink, so a long file name ends in an ellipsis rather than widening a phone's page (#278). */
.mud-select:has(> .template-drawing-choice) {
    flex: 1 1 14rem;
    min-width: 0;
}

.template-drawing-choice .mud-select-input {
    text-overflow: ellipsis;
}

/* Picking a caption on the drawing (GitHub #275 slice 2): what to do shares a line with its icon and Stop where there is
   room, and wraps under the icon on a phone. */
.template-pick-ask {
    flex: 1 1 14rem;
    min-width: 0;
}

.template-test-values {
    list-style: none;
    margin: 0;
    padding: 0;
}

/* What the drawing lights round the selected field, in words (GitHub #278): its zone, caption and ruled cell in one compact
   line under the drawing, each with the review screen's icon, wrapping on a phone. Nothing takes room while nothing is said.
   A fact that lights its cue says so under the pointer, as the review screen's lines do. */
.template-drawing-facts {
    gap: 2px 12px;
    min-height: 0;
}

/* Out of the flow while nothing is said, never out of the accessibility tree: a live region hidden with display: none and shown
   with its words is a new region to a screen reader, which says nothing of it - the first field selected went unsaid. */
.template-drawing-facts:empty {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
}

.template-drawing-fact {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 0 4px;
    margin-left: -4px;
    color: var(--mud-palette-text-secondary);
    overflow-wrap: anywhere;
}

.template-drawing-fact .mud-icon-root {
    flex-shrink: 0;
}

.template-drawing-fact[data-cue-kind]:hover {
    background-color: var(--mud-palette-action-default-hover);
    border-radius: var(--mud-default-borderradius);
}

/* The builder's Output tab (named Files until GitHub #518; GitHub #275 piece 8): the columns beside the files and the chosen
   file's example, one column on a phone, two from 960 px. Every row is one line that wraps only when it must: a small heading,
   its short words, the control and its (i), aligned on their middles. */
.template-files {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 16px;
    align-items: start;
}

@media (min-width: 960px) {
    .template-files {
        grid-template-columns: minmax(280px, 0.7fr) minmax(0, 1.5fr);
        gap: 24px;
    }
}

/* On a phone, For developers goes last, after the files and their example: it is for few, and what a person came to set is
   first. From 960 px it stays under the columns, in the left column. */
@media (max-width: 959.98px) {
    .template-files-content {
        display: contents !important;
    }

    .output-developers {
        order: 1;
    }
}

.output-section {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.output-line {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    column-gap: 12px;
    row-gap: 0;
    min-width: 0;
}

.output-line--tight {
    column-gap: 4px;
    flex-wrap: nowrap;
}

.output-line--between {
    justify-content: space-between;
}

.output-heading {
    margin: 0;
}

/* A switch that is on shows it by more than where its thumb sits (GitHub #544): the theme's primary colour is graphite in both
   palettes, so MudBlazor's half-opaque primary track read as the same grey as an off one. On, the track is the positive status
   colour, solid, and its thumb the colour set on that status (OnStatus) - the pair ThemeContrastTests holds at 4.5:1 in both
   palettes; off keeps MudBlazor's own neutral track and thumb. Every switch in the app, set once here. */
.mud-switch .mud-switch-base.mud-checked + .mud-switch-track {
    /* MudBlazor paints the track's colour class with !important, so this must too. */
    background-color: var(--mud-palette-success) !important;
    opacity: 1;
}

.mud-switch .mud-switch-base.mud-checked [class*="mud-switch-thumb"] {
    background-color: var(--mud-palette-success-text);
    color: var(--mud-palette-success-text);
}

/* A switch that is off is still a control a person must see (GitHub #545, WCAG 1.4.11 non-text contrast): MudBlazor's track is the
   neutral action colour at half strength, 2.05:1 on the light surface and 2.55:1 on the dark, and its thumb 2.04:1 on that track
   in light. Off, the track is the colour of a control's own edge (the one ThemeContrastTests holds at 3:1 on every surface) and
   the thumb the page's own colour, which stands 3:1 from it in both palettes (SwitchStateTests). A disabled switch keeps
   MudBlazor's faded one: it is exempt, and fading is how it says so. */
.mud-switch .mud-switch-base:not(.mud-checked):not(.mud-switch-disabled) + .mud-switch-track {
    /* MudBlazor paints the track's colour class with !important, so this must too. */
    background-color: var(--mud-palette-lines-inputs) !important;
    opacity: 1;
}

.mud-switch .mud-switch-base:not(.mud-checked):not(.mud-switch-disabled) [class*="mud-switch-thumb"] {
    background-color: var(--mud-palette-background);
    color: var(--mud-palette-background);
}

/* A switch's row is a 44 px target under a finger and on a phone's width (GitHub #545): MudBlazor draws it 38 px tall. A mouse on
   a wide window keeps the compact row. A switch with a long label is taller than this already and a label that wraps stays so. */
@media (pointer: coarse), (max-width: 599.98px) {
    .mud-switch {
        min-height: 44px;
    }
}

.output-options {
    display: flex;
    flex-direction: column;
    gap: 0;
}

/* A radio or a switch in the output options is a 44 px target under a finger; with a mouse it keeps its dense size. */
@media not all and (pointer: fine) {
    .output-options .mud-radio,
    .output-options .mud-switch {
        min-height: 44px;
    }
}

/* The (i) beside a label (Shared/Hints/InfoTip): drawn small, a 44 px target under a finger without moving its neighbours. */
.info-tip .hint-trigger {
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

@media not all and (pointer: fine) {
    .info-tip .hint-trigger {
        min-width: 44px;
        min-height: 44px;
        margin: -12px;
    }
}

/* The guided start (GitHub #275 decision 10): what a new template is for, a card each - one column on a phone, two from
   600 px, three in the dialog's full width. Each card is the radio itself, so a tap anywhere on it chooses it and the
   arrow keys move between them; the chosen one takes the primary edge, never a colour of its own. */
.template-purposes {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 8px;
}

@media (min-width: 600px) {
    .template-purposes {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (min-width: 900px) {
    .template-purposes {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

.template-purpose {
    margin: 0;
    height: 100%;
    align-items: flex-start;
    padding: 4px 12px 4px 0;
    border: 1px solid var(--mud-palette-lines-default);
    border-radius: var(--mud-default-borderradius);
    background-color: var(--mud-palette-surface);
}

.template-purpose .mud-input-control-input-container,
.template-purpose .mud-radio {
    width: 100%;
    height: 100%;
    align-items: flex-start;
}

.template-purpose .mud-radio {
    cursor: pointer;
}

.template-purpose--chosen {
    border-color: var(--mud-palette-primary);
    box-shadow: inset 0 0 0 1px var(--mud-palette-primary);
}

.template-purpose-copy {
    flex: 1 1 16rem;
    min-width: 0;
}

/* A heading of the Output tab's example renamed where it is shown (GitHub #275 slice 2): the heading's own words, as the
   file has them, on a quiet button with a pencil; the box that renames it takes the column's width and no less than a
   name's room. */
.template-export-heading-rename.mud-button-root {
    text-transform: none;
    letter-spacing: normal;
    font-weight: inherit;
    font-size: inherit;
    padding: 2px 6px;
    margin: -2px -6px;
    white-space: nowrap;
    justify-content: flex-start;
}

.template-export-heading-rename--tab.mud-button-root {
    font-weight: 700;
    margin-right: 0;
}

.template-export-heading-box {
    min-width: 12rem;
    margin: 0;
}

.add-fields-description {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* The sheet progress bar under "Reading this drawing" (GitHub #495): a width of its own, because the row it sits in shrinks to
   its content, and a percentage of that left a stub 30 px wide. */
.reading-progress {
    width: min(20rem, 70vw);
}

/* The admin Workspace use table (GitHub #557): the first column holds a workspace's whole reference, so on a wide screen it keeps
   room for it on one or two lines; stacked on a phone it takes the cell's width and wraps. */
@media (min-width: 960px) {
    .workspace-use-table .workspace-use-first {
        min-width: 13rem;
    }
}

/* Tighter cells than MudBlazor's dense table, so a dozen numbers fit beside the reference on a laptop. */
.workspace-use-table .mud-table-cell {
    padding-left: 8px;
    padding-right: 8px;
}

/* The sample banner folded below 960 px (a phone's review screen, GitHub #562): nothing on screen - the sheet's own Sample label
   says it - and the banner kept for a screen reader, which hears the same status as before. */
@media (max-width: 959.98px) {
    [data-testid="sample-data-banner"][data-folded] {
        position: absolute;
        width: 1px;
        height: 1px;
        margin: -1px;
        padding: 0;
        overflow: hidden;
        clip-path: inset(50%);
        white-space: nowrap;
    }
}

/* The same screen's header is one row (GitHub #579): the screen's own row (the review screen's tabs) sits between the name and the icons
   instead of under them - a row of its own was 46 px of the 390 a sideways phone has. Where the three do not fit it wraps under them. */
@media (min-width: 600px) and (max-height: 480px) {
    .work-header-bar .work-header-below {
        flex: 0 0 340px;
        order: 1;
    }

    .work-header-bar .work-header-actions {
        order: 2;
    }
}

/* A phone held sideways (GitHub #579): under about 480 px of height on a touch screen the phone's drawing is no longer given the 360 px a
   portrait phone's floor is (SheetReviewView.PhoneHeight reads this): it is what the screen leaves under the header and the tabs, with the
   value's sheet in a column beside it, so the page does not scroll to reach Accept and Correct. The floor is 160 px, not 180 (GitHub #723): a window
   360 px tall with the sheet steps of a two-sheet drawing under the tabs leaves the panes 169 px, and a 180 px floor ran the card 11 px past the window. */
@media (max-height: 480px) {
    :root {
        --phone-drawing-least-height: 160px;
    }
}
