h1:focus {
    outline: none;
}

.blazor-error-boundary {
    background: #b32121;
    padding: 1rem 1rem 1rem 3.7rem;
    color: white;
}

.blazor-error-boundary::after {
    content: "An error has occurred."
}

/* ── Nav menu ───────────────────────────────────────────── */

/* Logout is a <button> (it must POST) wearing .mud-nav-link. Resets the UA button styling only. */
.nav-logout {
    background: none;
    border: 0;
    cursor: pointer;
    font: inherit;
    color: inherit;
    text-align: start;
}

/* MudBlazor scopes the nav hover to anchors. */
.nav-logout:hover {
    background-color: var(--mud-palette-action-default-hover);
}

/* ── Documents diagnostic ───────────────────────────────── */

/* Inline preview in each file row. object-fit:contain, not cover: cropping a portrait page to a square
   shows its middle band, which is the least identifiable part of a document. Contain keeps the whole page
   and its true shape, letterboxed on white. */
.doc-thumb {
    width: 36px;
    height: 46px;
    flex: 0 0 auto;
    object-fit: contain;
    border-radius: 4px;
    border: 1px solid var(--mud-palette-lines-default);
    background: #fff;
}

/* ── Tooltips ───────────────────────────────────────────── */

/* MudBlazor sets no width on the tooltip, so one anchored near the right edge shrink-to-fits the space
   left and wraps a word per line. max-content sizes it to its text instead; the max-width keeps long
   ones wrapping and inside the viewport. */
.mud-tooltip {
    width: max-content;
    max-width: min(320px, calc(100vw - 32px));
}

/* ── Snackbars / toasts ─────────────────────────────────── */

/* MudBlazor only exposes transition DURATIONS, not the style, so the default is a plain fade. This replaces
   the entrance with a slide-in from the right and a slight scale overshoot ("pop"). Entrance only — the exit
   stays MudBlazor's own hide transition. The overshoot lives in both the keyframe (1.04) and the easing. */
@keyframes toast-slide-pop {
    0%   { transform: translateX(60px) scale(0.85); opacity: 0; }
    60%  { transform: translateX(0) scale(1.04); opacity: 1; }
    100% { transform: translateX(0) scale(1); opacity: 1; }
}

.mud-snackbar {
    animation: toast-slide-pop 0.32s cubic-bezier(0.2, 0.9, 0.3, 1.2) both;
}

@media (prefers-reduced-motion: reduce) {
    .mud-snackbar {
        animation: none;
    }
}

/* ── App bar ────────────────────────────────────────────── */

.appbar-logo {
    height: 26px;
    width: auto;
    margin-right: 10px;
    vertical-align: middle;
}

.appbar-debug {
    background-image: repeating-linear-gradient(-45deg,
        rgba(255, 255, 255, 0.07) 0 12px,
        transparent 12px 24px) !important;
}

.appbar-debug::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 5px;
    background: repeating-linear-gradient(-45deg,
        #ffc107 0 10px,
        #212121 10px 20px);
}

.appbar-debug-label {
    margin-left: auto;
    padding: 3px 12px;
    border: 1px solid rgba(255, 193, 7, 0.8);
    border-radius: 999px;
    background: rgba(0, 0, 0, 0.25);
    color: #ffc107;
    font-weight: 600;
    letter-spacing: 0.1em;
}

/* ── Login / Account pages ─────────────────────────────── */

.auth-page {
    /* No min-height:100vh — this page renders inside the MudBlazor shell (64px app-bar + container padding),
       so forcing full viewport height pushed the total past 100vh and produced a scrollbar. The shell already
       fills the viewport and the background is white, so the card just needs top spacing. */
    display: flex;
    align-items: flex-start;
    justify-content: center;
    background: #fff;
    padding: 7vh 1rem 2rem;
}

.auth-card {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 4px 24px rgba(0,0,0,.12);
    padding: 2.5rem 2rem;
    width: 100%;
    max-width: 420px;
}

.auth-header {
    text-align: center;
    margin-bottom: 2rem;
}

/* Sized off the card's 420px width rather than a fixed height, so it scales with the card. */
.auth-logo {
    width: 150px;
    height: auto;
    display: block;
    margin: 0 auto;
}

.auth-header h1 {
    font-size: 1.4rem;
    font-weight: 700;
    color: #1a1a2e;
    margin: .75rem 0 .25rem;
}

.auth-header p {
    color: #666;
    font-size: .9rem;
    margin: 0;
}

/* Account/Manage pages reuse .auth-field for inputs, but sit inside the MudBlazor shell rather than the
   login card, so they need their own width and status styling. */
.acct-form {
    max-width: 460px;
}

.acct-status {
    border-radius: 6px;
    padding: .75rem 1rem;
    font-size: .875rem;
    margin-bottom: 1.25rem;
}

.acct-status-success {
    background: #e8f5e9;
    color: #2e7d32;
}

.acct-status-error {
    background: #fdecea;
    color: #c62828;
}

.auth-field input:disabled {
    background: #f0f0f0;
    color: #777;
    cursor: not-allowed;
}

.auth-error {
    background: #fdecea;
    color: #c62828;
    border-radius: 6px;
    padding: .75rem 1rem;
    font-size: .875rem;
    margin-bottom: 1.25rem;
}

.auth-field {
    margin-bottom: 1.1rem;
}

.auth-field label {
    display: block;
    font-size: .8125rem;
    font-weight: 600;
    color: #444;
    margin-bottom: .35rem;
    letter-spacing: .01em;
}

.auth-field input {
    width: 100%;
    padding: .7rem 1rem;
    border: 1.5px solid #d0d0d0;
    border-radius: 7px;
    font-size: .95rem;
    box-sizing: border-box;
    transition: border-color .18s, box-shadow .18s;
    background: #fafafa;
    color: #1a1a1a;
}

.auth-field input:focus {
    outline: none;
    border-color: #1976d2;
    box-shadow: 0 0 0 3px rgba(25,118,210,.12);
    background: #fff;
}

.auth-field input::placeholder {
    color: #aaa;
}

.auth-validation {
    display: block;
    color: #c62828;
    font-size: .78rem;
    margin-top: .25rem;
}

.auth-remember {
    display: flex;
    align-items: center;
    gap: .5rem;
    margin: .75rem 0 1.25rem;
    font-size: .875rem;
    color: #555;
}

.auth-remember input[type=checkbox] {
    width: 16px;
    height: 16px;
    accent-color: #1976d2;
}

.auth-btn {
    width: 100%;
    padding: .8rem;
    background: #1976d2;
    color: #fff;
    border: none;
    border-radius: 7px;
    font-size: .95rem;
    font-weight: 600;
    cursor: pointer;
    letter-spacing: .02em;
    transition: background .18s, box-shadow .18s;
    box-shadow: 0 2px 8px rgba(25,118,210,.25);
}

.auth-btn:hover {
    background: #1565c0;
    box-shadow: 0 4px 12px rgba(25,118,210,.35);
}

.auth-btn:active {
    background: #0d47a1;
}

.auth-links {
    margin-top: 1.5rem;
    text-align: center;
    display: flex;
    flex-direction: column;
    gap: .5rem;
}

.auth-links a {
    color: #1976d2;
    text-decoration: none;
    font-size: .875rem;
    transition: color .15s;
}

.auth-links a:hover {
    color: #1565c0;
    text-decoration: underline;
}

/* "or" separator between password sign-in and external providers */
.auth-divider {
    display: flex;
    align-items: center;
    color: #9aa0a6;
    font-size: .78rem;
    text-transform: uppercase;
    letter-spacing: .06em;
    margin: 1.5rem 0;
}

.auth-divider::before,
.auth-divider::after {
    content: "";
    flex: 1;
    border-bottom: 1px solid #e6e6e6;
}

.auth-divider::before { margin-right: .75rem; }
.auth-divider::after { margin-left: .75rem; }

.auth-external-form { margin: 0; }

/* External-provider (SSO) button — white with subtle border, provider logo on the left */
.auth-external-btn {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: .6rem;
    padding: .75rem;
    background: #fff;
    color: #3c4043;
    border: 1.5px solid #d0d0d0;
    border-radius: 7px;
    font-size: .95rem;
    font-weight: 600;
    cursor: pointer;
    transition: background .18s, border-color .18s, box-shadow .18s;
}

.auth-external-btn + .auth-external-btn { margin-top: .6rem; }

.auth-external-btn:hover {
    background: #f7f9fc;
    border-color: #b8b8b8;
    box-shadow: 0 2px 8px rgba(0,0,0,.08);
}

.auth-external-btn svg { flex: 0 0 auto; }

/* ── TableFit (Components/Shared/TableFit.razor) ───────── */
/* Pager pinned to the viewport bottom, sticky header, and rows stretched so the fitted page fills the body
   exactly. A page sets --fit-floor (minimum row height) and, if its chrome differs, --fit-offset on its
   wrapper; TableFit supplies --fit-rows and --fit-head. */
.table-fit .mud-table-container {
    height: calc(100vh - var(--fit-offset, 280px));
    overflow-y: auto;
}

.table-fit thead {
    position: sticky;
    top: 0;
    z-index: 3;
}

.table-fit thead th {
    background: var(--mud-palette-surface);
}

/* One line per cell: the table scrolls sideways instead, and a fixed row height can rely on it. */
.table-fit th,
.table-fit td {
    white-space: nowrap;
}

.table-fit tbody td {
    height: max(var(--fit-floor, 40px),
                calc((100vh - var(--fit-offset, 280px) - var(--fit-head, 56px)) / var(--fit-rows, 15) - 1px));
}

.table-fit-measuring tbody td {
    height: auto !important;
}



/* ── Upload Sessions ───────────────────────────────────── */

/* Soft "off red" tint for soft-deleted sessions in the admin table. Global (not scoped) because MudBlazor
   renders the <tr> outside any component's CSS scope. Also targets the cells and beats the hover rule. */
.mud-table-row.session-deleted,
.mud-table-row.session-deleted > td {
    background-color: rgba(244, 67, 54, 0.12) !important;
}

.mud-table-hover .mud-table-row.session-deleted:hover,
.mud-table-hover .mud-table-row.session-deleted:hover > td {
    background-color: rgba(244, 67, 54, 0.20) !important;
}

/* ── Payment Links ─────────────────────────────────────── */
/* Global, not scoped: MudBlazor renders the <tr>, <td> and chip outside the component's CSS scope. */

/* Rows needing attention. !important beats MudTable's row and hover backgrounds. */
.mud-table-row.pl-attention,
.mud-table-row.pl-attention > td {
    background-color: rgba(244, 67, 54, 0.10) !important;
}

.mud-table-hover .mud-table-row.pl-attention:hover,
.mud-table-hover .mud-table-row.pl-attention:hover > td {
    background-color: rgba(244, 67, 54, 0.18) !important;
}

.mud-table-root th.pl-center,
.mud-table-root td.pl-center {
    text-align: center;
}

/* Pulses a status that just changed. Fades a surface-coloured overlay over the chip rather than recolouring it,
   so it works for any status and theme. z-index:-1 keeps the overlay below the label; isolation makes that
   reliable. */
@keyframes pl-pulse {
    0%, 100% { opacity: 0; }
    50% { opacity: 0.72; }
}

/* Two classes, one animation, alternated per change — an animation only restarts when its class is added. */
.mud-chip.pl-pulse-a,
.mud-chip.pl-pulse-b {
    position: relative;
    isolation: isolate;
}

.mud-chip.pl-pulse-a::after,
.mud-chip.pl-pulse-b::after {
    content: "";
    position: absolute;
    inset: 0;
    z-index: -1;
    border-radius: inherit;
    background-color: var(--mud-palette-surface);
    pointer-events: none;
    animation: pl-pulse 1s ease-in-out 20;
}

@media (prefers-reduced-motion: reduce) {
    .mud-chip.pl-pulse-a::after,
    .mud-chip.pl-pulse-b::after {
        animation: none;
        opacity: 0.45;
    }
}

/* Suppressed: this table reloads on every change ping, so the bar flickers constantly. */
.pl-table .mud-progress-linear {
    display: none !important;
}

/* Copy button stays hidden until the pointer is anywhere on the row. Faded rather than
   display:none so the link never shifts sideways as it appears. Fades out on the way back so
   sweeping down the table doesn't strobe, but appears instantly on the way in. */
.case-row .case-copy-btn {
    opacity: 0;
    transition: opacity .15s ease-in-out;
    padding: 3px;
}

.case-row:hover .case-copy-btn,
.case-row .case-copy-btn:focus-visible {
    opacity: 1;
    transition-duration: 0s;
}

.case-row .case-copy-btn .mud-icon-root {
    font-size: 1rem;
}

.pd-body {
    position: relative;
    display: flex;
    justify-content: center;
    min-height: 160px;
}

.pd-loading {
    position: absolute;
    inset: 0;
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: var(--mud-palette-surface);
}

.pd-frame {
    width: 100%;
    height: 72vh;
    border: 1px solid var(--mud-palette-lines-default);
    background: #fff;
}

.pd-image,
.pd-video {
    max-width: 100%;
    max-height: 72vh;
}

.pd-audio {
    width: 100%;
}

.case-link {
    color: inherit;
    text-decoration: none;
}

.case-link:hover {
    color: var(--mud-palette-primary);
    text-decoration: underline;
}

/* ── AppDialog ─────────────────────────────────────────── */

/* Global rather than scoped: MudDialog renders these elements outside AppDialog's CSS scope. */
.app-dialog .mud-dialog-title {
    padding: 20px 16px 12px 24px;
    border-bottom: 1px solid var(--mud-palette-lines-default);
}

.app-dialog .mud-dialog-content {
    padding: 20px 24px;
}

.app-dialog .mud-dialog-actions {
    padding: 8px 24px 20px;
    gap: 12px;
}

.app-dialog .mud-dialog-actions > * {
    margin-left: 0;
}

.mud-dialog.app-dialog:has(.pv-dialog) {
    width: min(1320px, calc(100vw - 32px));
    max-width: none;
    max-height: calc(100vh - 32px);
    margin: 0;
}

.app-dialog .mud-dialog-content:has(.pv-dialog) {
    overflow: hidden;
}

.pv-dialog {
    width: min(1304px, calc(100vw - 48px));
    height: calc(100vh - 88px);
}

/* Three classes, to outrank the wrapper's own scoped rule. */
.app-dialog .pv-dialog .ph-table-wrap {
    --fit-offset: 188px;
}

.ph-table-wrap .mud-table-root .mud-table-row .mud-table-cell,
.ph-table-wrap .mud-table-root .mud-table-row .mud-table-cell:last-child {
    padding: 2px 10px;
    font-size: 0.78rem;
}

.app-dialog-compact .mud-dialog-title {
    padding: 3px 6px 3px 12px;
}

.app-dialog-compact .mud-dialog-content {
    padding: 8px;
}

/* Soft-deleted payment links, shown only when "Show deleted" is on. Same off-red tint as Upload Sessions'
   .session-deleted — the standard deleted-row style (see CLAUDE.md). !important beats MudTable's own row and
   hover backgrounds. */
.mud-table-row.pl-deleted,
.mud-table-row.pl-deleted > td,
.mud-table-row.ds-deleted,
.mud-table-row.ds-deleted > td,
.mud-table-row.mc-inactive,
.mud-table-row.mc-inactive > td {
    background-color: rgba(244, 67, 54, 0.12) !important;
}

.mud-table-hover .mud-table-row.pl-deleted:hover,
.mud-table-hover .mud-table-row.pl-deleted:hover > td,
.mud-table-hover .mud-table-row.ds-deleted:hover,
.mud-table-hover .mud-table-row.ds-deleted:hover > td,
.mud-table-hover .mud-table-row.mc-inactive:hover,
.mud-table-hover .mud-table-row.mc-inactive:hover > td {
    background-color: rgba(244, 67, 54, 0.20) !important;
}

/* A select option followed by a dividing line. Lives here because the list renders in a popover, outside
   component CSS scope. */
.mc-option-divided {
    border-bottom: 1px solid var(--mud-palette-divider);
}

/* A MudSelect is a read-only input underneath, and focusing it shows a text caret beside the chosen value.
   Nothing can be typed there, so hide it. */
.mud-select input.mud-input-root {
    caret-color: transparent;
    cursor: pointer;
}

/* ── Document signing: the request dialog (dialog content, so not scoped) ── */
.app-dialog .mud-dialog-content:has(.sr-body) {
    overflow: hidden;
}

.sr-body {
    display: flex;
    flex-direction: column;
    height: min(640px, calc(100vh - 260px));
    min-height: 360px;
}

.sr-head {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 8px;
}

.sr-tabs {
    flex: 1 1 0;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

.sr-tabs .mud-tabs-tabbar,
.sr-tabs .mud-tabs-toolbar {
    flex: 0 0 auto;
    border-bottom: 1px solid var(--mud-palette-lines-default);
}

.sr-tabs .sr-panels {
    flex: 1 1 0;
    min-height: 0;
    overflow-y: auto;
    scrollbar-gutter: stable;
    padding: 20px 4px 8px 0;
}

.sr-fields {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px 32px;
    margin: 0;
}

.sr-fields dt {
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--mud-palette-text-secondary);
    margin-bottom: 2px;
}

.sr-fields dd {
    margin: 0;
    font-size: 0.9375rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sr-fields .sr-wide {
    grid-column: 1 / -1;
}

.sr-fields .sr-message {
    white-space: pre-wrap;
    overflow: visible;
}

.sr-fields .sr-wrap {
    white-space: normal;
    overflow: visible;
    overflow-wrap: anywhere;
}

.sr-fields-detail {
    gap: 12px 32px;
}

.sr-table .sr-chevron {
    width: 36px;
    padding-right: 0;
    color: var(--mud-palette-text-secondary);
}

.sr-table .sr-row {
    cursor: pointer;
}

.sr-table .sr-row:hover > td {
    background: var(--mud-palette-action-default-hover);
}

.sr-table .sr-expand > td {
    padding: 14px 16px 16px 52px;
    background: var(--mud-palette-background-gray);
}

.sr-mono {
    font-family: monospace;
    font-size: 0.8125rem;
}

.sr-section {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 28px 0 8px;
    font-size: 0.875rem;
    font-weight: 600;
}

.sr-count {
    min-width: 20px;
    padding: 0 6px;
    border-radius: 10px;
    background: var(--mud-palette-action-default-hover);
    font-size: 0.75rem;
    line-height: 20px;
    text-align: center;
}

@media (max-width: 720px) {
    .sr-fields { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* ── Document signing: placing signature boxes (dialog content, so not scoped) ── */
.app-dialog .mud-dialog-content:has(.sp-layout) {
    overflow: hidden;
}

.sp-layout {
    display: flex;
    gap: 24px;
    height: calc(100vh - 260px);
    min-height: 380px;
}

.sp-form {
    flex: 0 0 380px;
    min-width: 0;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

/* MudBlazor inputs are flex: 1 1 auto, so in this column they would stretch and squeeze the list.
   Everything but the recipient list keeps its natural height. */
.sp-form > *:not(.sp-signers) {
    flex: 0 0 auto;
}

.sp-brand {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.sp-brand-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
}

.sp-signers {
    flex: 1 1 0;
    min-height: 120px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    overflow-y: auto;
    scrollbar-gutter: stable;
}

.sp-form-foot {
    flex: 0 0 auto;
    padding-top: 4px;
}

.sp-signer {
    flex: 0 0 auto;
    display: grid;
    grid-template-columns: 26px 1fr auto;
    gap: 10px;
    align-items: start;
    border-left: 6px solid var(--sp-colour);
    border-radius: 6px;
    background: color-mix(in srgb, var(--sp-colour) 9%, transparent);
    padding: 10px 6px 10px 10px;
}

.sp-signer-fields {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
}

.sp-signer .sp-field {
    margin: 0;
}

.sp-signer .sp-field .mud-input-outlined {
    background: var(--mud-palette-surface);
}

.sp-signer .sp-remove {
    margin-top: 2px;
}

.sp-signer-foot {
    display: flex;
    align-items: center;
    gap: 8px;
    height: 30px;
}

.sp-type {
    height: 28px;
    padding: 0 6px;
    border: 1px solid var(--mud-palette-lines-inputs);
    border-radius: 4px;
    background: var(--mud-palette-surface);
    color: var(--mud-palette-text-primary);
    font: inherit;
    font-size: 12px;
}

.sp-cc-note {
    font-size: 12px;
    line-height: 28px;
    color: var(--mud-palette-text-secondary);
    white-space: nowrap;
}

.sp-place {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 28px;
    padding: 0 12px 0 8px;
    border: 0;
    border-radius: 16px;
    background: var(--sp-colour);
    color: #fff;
    font: inherit;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
    cursor: pointer;
}

.sp-place:hover:not(:disabled) {
    filter: brightness(1.08);
}

.sp-place:disabled {
    opacity: 0.4;
    cursor: default;
}

.sp-badge {
    margin-top: 7px;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: var(--sp-colour);
    color: #fff;
    font-size: 13px;
    font-weight: 700;
    line-height: 26px;
    text-align: center;
}

.sp-send-hint {
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.875rem;
    color: var(--mud-palette-text-secondary);
    white-space: nowrap;
    overflow: hidden;
}

.sp-send-hint > span {
    overflow: hidden;
    text-overflow: ellipsis;
}

.sp-send-hint-error {
    color: var(--mud-palette-error);
    font-weight: 600;
}

.sp-heading {
    flex: 0 0 auto;
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    margin: 16px 0 4px;
}

.sp-required-note {
    font-size: 0.75rem;
    color: var(--mud-palette-text-secondary);
}

.sp-star {
    color: var(--mud-palette-error);
    font-weight: 700;
}

.sp-place-todo {
    background: var(--mud-palette-surface);
    color: var(--sp-colour);
    box-shadow: inset 0 0 0 1.5px var(--sp-colour);
}

.sp-place-missing {
    background: var(--mud-palette-surface);
    color: var(--mud-palette-error);
    box-shadow: inset 0 0 0 2px var(--mud-palette-error);
}

.sp-empty.sp-empty-missing {
    color: var(--mud-palette-error);
    border-color: var(--mud-palette-error);
    background: color-mix(in srgb, var(--mud-palette-error) 6%, transparent);
}

.sp-preview {
    position: relative;
    flex: 1 1 auto;
    min-width: 0;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

.sp-pager {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    gap: 4px;
    height: 40px;
    margin-bottom: 8px;
    font-size: 0.875rem;
}

.sp-pager-count {
    min-width: 96px;
    text-align: center;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

.sp-file-name {
    flex: 1 1 auto;
    min-width: 0;
    margin-left: 12px;
    text-align: right;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sp-file-size {
    flex: 0 0 auto;
    margin-left: 6px;
    color: var(--mud-palette-text-secondary);
    white-space: nowrap;
}

.sp-scroll {
    flex: 1 1 0;
    min-height: 0;
    overflow-y: auto;
    scrollbar-gutter: stable;
    padding: 2px 6px 12px 2px;
}

.sp-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    height: 100%;
    padding: 24px;
    text-align: center;
    color: var(--mud-palette-text-secondary);
    background: color-mix(in srgb, var(--mud-palette-primary) 3%, transparent);
    border: 2px dashed var(--mud-palette-lines-inputs);
    border-radius: 12px;
    cursor: pointer;
    transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.sp-empty:hover,
.sp-empty:focus-visible {
    color: var(--mud-palette-primary);
    background: color-mix(in srgb, var(--mud-palette-primary) 10%, transparent);
    border-color: var(--mud-palette-primary);
}

.sp-empty .sp-empty-icon {
    font-size: 64px;
    transition: transform 0.15s ease;
}

.sp-empty:hover .sp-empty-icon {
    transform: translateY(-4px);
}

.sp-empty-title {
    font-size: 1.1rem;
    font-weight: 600;
}

.sp-empty-sub {
    font-size: 0.875rem;
}

.sp-drop-hint,
.sp-busy {
    position: absolute;
    inset: 0;
    z-index: 5;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    font-weight: 600;
    color: var(--mud-palette-primary);
    border-radius: 8px;
}

.sp-drop-hint {
    display: none;
    background: color-mix(in srgb, var(--mud-palette-primary) 12%, rgba(255, 255, 255, 0.92));
    border: 2px dashed var(--mud-palette-primary);
    pointer-events: none;
}

.sp-dropping .sp-drop-hint {
    display: flex;
}

.sp-busy {
    display: flex;
    background: var(--mud-palette-surface);
}

.sp-page {
    position: relative;
    width: 100%;
    background: var(--mud-palette-surface);
    border: 1px solid var(--mud-palette-lines-default);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.12);
    user-select: none;
    line-height: 0;
}

.sp-page img {
    display: block;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.sp-box {
    position: absolute;
    container-type: size;
    border: 2px solid var(--sp-colour);
    background: color-mix(in srgb, var(--sp-colour) 24%, rgba(255, 255, 255, 0.6));
    border-radius: 10px;
    box-shadow: 0 2px 8px color-mix(in srgb, var(--sp-colour) 28%, transparent);
    cursor: move;
    touch-action: none;
    line-height: 1.2;
}

.sp-box::after {
    content: '';
    position: absolute;
    left: 8%;
    right: 8%;
    bottom: 16%;
    border-bottom: 1px dashed color-mix(in srgb, var(--sp-colour) 55%, transparent);
    pointer-events: none;
}

.sp-box-new {
    animation: sp-box-flash 0.6s ease-in-out 2;
}

.sp-flash {
    animation: sp-flash 0.45s ease-in-out 3;
}

@keyframes sp-flash {
    50% {
        background: color-mix(in srgb, var(--mud-palette-error) 22%, transparent);
        box-shadow: inset 0 0 0 2px var(--mud-palette-error);
    }
}

@keyframes sp-box-flash {
    50% { box-shadow: 0 0 0 6px color-mix(in srgb, var(--sp-colour) 40%, transparent); }
}

.sp-box-label {
    position: absolute;
    left: -2px;
    top: -2px;
    max-width: calc(100% - 60px);
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px 2px 6px;
    border-radius: 10px 0 8px 0;
    background: var(--sp-colour);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    pointer-events: none;
}

.sp-box-label svg {
    flex: 0 0 auto;
    width: 15px;
    height: 15px;
    fill: currentColor;
}

.sp-box-label .pen-ink {
    fill: none;
    stroke: currentColor;
    stroke-width: 1.4;
    stroke-linecap: round;
}

.sp-acts {
    position: absolute;
    top: -11px;
    right: -6px;
    display: flex;
    gap: 3px;
}

.sp-act {
    width: 18px;
    height: 18px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: var(--sp-colour);
    color: #fff;
    font-size: 12px;
    line-height: 18px;
    cursor: pointer;
}

.sp-handle {
    position: absolute;
    right: -5px;
    bottom: -5px;
    width: 12px;
    height: 12px;
    background: var(--sp-colour);
    border: 2px solid #fff;
    border-radius: 50%;
    cursor: nwse-resize;
}

@media (max-width: 960px) {
    .app-dialog .mud-dialog-content:has(.sp-layout) { overflow: auto; }
    .sp-layout { flex-direction: column; height: auto; }
    .sp-form { flex-basis: auto; width: 100%; }
    .sp-signers { flex: 0 0 auto; max-height: 40vh; }
    .sp-preview { width: 100%; }
    .sp-scroll { flex: 0 0 auto; overflow: visible; }
    .sp-empty { min-height: 240px; }
}

.wa-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    width: 100%;
}

.wa-nav-count {
    margin-right: 12px;
    min-width: 20px;
    padding: 0 6px;
    border-radius: 10px;
    background: var(--mud-palette-error);
    color: var(--mud-palette-error-text);
    font-size: 0.72rem;
    font-weight: 600;
    line-height: 20px;
    text-align: center;
}

.wa-filter .mud-toggle-item {
    padding: 4px 6px;
    min-width: 0;
}

.wa-filter {
    grid-template-columns: repeat(4, auto) !important;
}

.wa-filter .wa-filter-unread {
    position: relative;
}

.wa-filter .wa-filter-unread::after {
    content: "";
    position: absolute;
    top: 3px;
    right: 3px;
    width: 8px;
    height: 8px;
    border: 1px solid var(--mud-palette-surface);
    border-radius: 50%;
    background: var(--mud-palette-error);
}

.wa-filter .mud-button-label {
    font-size: 0.72rem;
    letter-spacing: 0;
}

.wa-media-name {
    display: block;
    font-style: normal;
}

.wa-viewer {
    display: flex;
    justify-content: center;
    background: var(--mud-palette-background-gray);
    border-radius: 4px;
    margin-bottom: 12px;
}

.wa-viewer img {
    max-width: 100%;
    max-height: 62vh;
    object-fit: contain;
}

.wa-viewer-pdf {
    display: block;
    width: 100%;
    height: 68vh;
    margin-bottom: 12px;
    border: 1px solid var(--mud-palette-lines-default);
    border-radius: 4px;
}

.wa-viewer-file {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 12px;
}

.wa-viewer-history {
    margin-top: 10px;
    font-size: 0.8rem;
    color: var(--mud-palette-text-secondary);
}

.wa-viewer-failed {
    color: var(--mud-palette-error);
}

.wa-case-head {
    display: flex;
    align-items: center;
    margin-bottom: 6px;
}

.wa-case-empty {
    padding: 14px 4px;
    color: var(--mud-palette-text-secondary);
    font-size: 0.875rem;
}

.wa-case-list {
    max-height: 46vh;
    overflow-y: auto;
    border: 1px solid var(--mud-palette-lines-default);
    border-radius: 4px;
}

.wa-case-row {
    display: grid;
    grid-template-columns: 24px 130px minmax(140px, 1.2fr) 110px 130px minmax(160px, 1.4fr);
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 8px 12px;
    border: 0;
    border-bottom: 1px solid var(--mud-palette-lines-default);
    background: none;
    font: inherit;
    font-size: 0.875rem;
    text-align: left;
    cursor: pointer;
}

.wa-case-row:last-child {
    border-bottom: 0;
}

.wa-case-row:hover {
    background: var(--mud-palette-action-default-hover);
}

.wa-case-selected,
.wa-case-selected:hover {
    background: var(--mud-palette-primary-hover);
}

.wa-case-number {
    font-weight: 600;
}

.wa-case-client,
.wa-case-number {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.wa-case-type,
.wa-case-date,
.wa-case-match {
    color: var(--mud-palette-text-secondary);
    white-space: nowrap;
}

.wa-case-tags {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px;
}

.wa-case-tags .mud-chip {
    margin: 0;
}

.wa-case-manual {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 14px;
    max-width: 460px;
}

.wa-history-list {
    max-height: 60vh;
    overflow-y: auto;
}

.wa-history-row {
    display: grid;
    grid-template-columns: 130px 180px 1fr;
    gap: 12px;
    padding: 6px 2px;
    border-bottom: 1px solid var(--mud-palette-lines-default);
    font-size: 0.875rem;
}

.wa-history-row:last-child {
    border-bottom: 0;
}

.wa-history-when,
.wa-history-who {
    color: var(--mud-palette-text-secondary);
}

.wa-tip {
    max-width: 230px;
    white-space: normal;
    text-align: left;
}

.settings-tabs .mud-tabs-tabbar {
    background: transparent;
    border-bottom: 1px solid var(--mud-palette-divider);
}

.settings-tab-count {
    margin-left: 8px;
    font-size: 0.75rem;
    font-weight: 400;
    text-transform: none;
    color: var(--mud-palette-text-secondary);
}

.wa-number {
    margin-left: 14px;
    padding: 2px 10px;
    border: 1px solid var(--mud-palette-lines-default);
    border-radius: 12px;
    font-size: 0.85rem;
    font-weight: 500;
    white-space: nowrap;
}

.wa-number-name {
    margin-left: 6px;
    font-weight: 400;
    color: var(--mud-palette-text-secondary);
}

.wa-health {
    display: inline-block;
    width: 8px;
    height: 8px;
    margin-right: 6px;
    border-radius: 50%;
    background: var(--mud-palette-action-disabled);
}

.wa-health-ok {
    background: var(--mud-palette-success);
}

.wa-health-warning {
    background: var(--mud-palette-warning);
}

.wa-health-failed {
    background: var(--mud-palette-error);
}

.wa-health-tip {
    max-width: 300px;
}

.wa-health-tip > div + div {
    margin-top: 6px;
}

.wa-health-tip b {
    margin-right: 4px;
}

.wa-health-checked {
    opacity: 0.7;
}

.wa-fmt-code,
.wa-fmt-block {
    font-family: Consolas, "Courier New", monospace;
    font-size: 0.85em;
    background: rgba(0, 0, 0, 0.06);
    border-radius: 3px;
    padding: 1px 4px;
}

.wa-fmt-block {
    display: block;
    padding: 6px 8px;
    white-space: pre-wrap;
}

.wa-fmt-link {
    color: var(--mud-palette-primary);
    text-decoration: underline;
}

.wa-fmt-quote {
    display: block;
    padding-left: 8px;
    border-left: 3px solid var(--mud-palette-lines-inputs);
    color: var(--mud-palette-text-secondary);
}

/* Emoji only: the font also holds digits, # and *, which must stay in the text font. */
@font-face {
    font-family: "Noto Color Emoji";
    src: url("fonts/NotoColorEmoji.woff2") format("woff2");
    unicode-range: U+200D, U+203C, U+2049, U+20E3, U+2139, U+2194-21AA, U+231A-23FF, U+24C2, U+25AA-25FE, U+2600-27BF,
        U+2934-2935, U+2B05-2B55, U+3030, U+303D, U+3297, U+3299, U+FE0F, U+1F000-1FAFF, U+E0020-E007F;
    font-display: swap;
}

.wa-layout,
.wa-preview,
.wa-react-row {
    font-family: "Noto Color Emoji", var(--mud-typography-default-family);
}

.wa-react-row {
    display: flex;
    gap: 2px;
    padding: 2px 8px;
}

.wa-react {
    width: 36px;
    height: 36px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: none;
    font-family: inherit;
    font-size: 1.3rem;
    line-height: 36px;
    cursor: pointer;
}

.wa-react:hover,
.wa-react-on {
    background: var(--mud-palette-action-default-hover);
}

.wa-input::highlight(wa-lint) {
    text-decoration: underline dotted;
    text-decoration-color: var(--mud-palette-info);
    background-color: rgba(33, 150, 243, 0.12);
}

.wa-input::highlight(wa-gap) {
    background-color: rgba(255, 152, 0, 0.3);
}

.wa-lint-menu {
    position: fixed;
    z-index: 1500;
    display: flex;
    gap: 4px;
    padding: 4px;
    border-radius: 6px;
    background: var(--mud-palette-surface);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.25);
}

.wa-lint-menu button {
    padding: 4px 10px;
    border: 0;
    border-radius: 4px;
    background: transparent;
    color: var(--mud-palette-text-primary);
    font: inherit;
    font-size: 0.875rem;
    cursor: pointer;
}

.wa-lint-menu button:hover {
    background: var(--mud-palette-action-default-hover);
}

.wa-lint-menu .wa-lint-ignore {
    color: var(--mud-palette-text-secondary);
}


.wa-transfer-popover .mud-list {
    overflow-x: hidden;
}
