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

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

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

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

.content {
    padding-top: 1.1rem;
}

h1:focus {
    outline: none;
}

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

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

.validation-message {
    color: #e50000;
}

.blazor-error-boundary {
    background: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTYiIGhlaWdodD0iNDkiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIG92ZXJmbG93PSJoaWRkZW4iPjxkZWZzPjxjbGlwUGF0aCBpZD0iY2xpcDAiPjxyZWN0IHg9IjIzNSIgeT0iNTEiIHdpZHRoPSI1NiIgaGVpZ2h0PSI0OSIvPjwvY2xpcFBhdGg+PC9kZWZzPjxnIGNsaXAtcGF0aD0idXJsKCNjbGlwMCkiIHRyYW5zZm9ybT0idHJhbnNsYXRlKC0yMzUgLTUxKSI+PHBhdGggZD0iTTI2My41MDYgNTFDMjY0LjcxNyA1MSAyNjUuODEzIDUxLjQ4MzcgMjY2LjYwNiA1Mi4yNjU4TDI2Ny4wNTIgNTIuNzk4NyAyNjcuNTM5IDUzLjYyODMgMjkwLjE4NSA5Mi4xODMxIDI5MC41NDUgOTIuNzk1IDI5MC42NTYgOTIuOTk2QzI5MC44NzcgOTMuNTEzIDI5MSA5NC4wODE1IDI5MSA5NC42NzgyIDI5MSA5Ny4wNjUxIDI4OS4wMzggOTkgMjg2LjYxNyA5OUwyNDAuMzgzIDk5QzIzNy45NjMgOTkgMjM2IDk3LjA2NTEgMjM2IDk0LjY3ODIgMjM2IDk0LjM3OTkgMjM2LjAzMSA5NC4wODg2IDIzNi4wODkgOTMuODA3MkwyMzYuMzM4IDkzLjAxNjIgMjM2Ljg1OCA5Mi4xMzE0IDI1OS40NzMgNTMuNjI5NCAyNTkuOTYxIDUyLjc5ODUgMjYwLjQwNyA1Mi4yNjU4QzI2MS4yIDUxLjQ4MzcgMjYyLjI5NiA1MSAyNjMuNTA2IDUxWk0yNjMuNTg2IDY2LjAxODNDMjYwLjczNyA2Ni4wMTgzIDI1OS4zMTMgNjcuMTI0NSAyNTkuMzEzIDY5LjMzNyAyNTkuMzEzIDY5LjYxMDIgMjU5LjMzMiA2OS44NjA4IDI1OS4zNzEgNzAuMDg4N0wyNjEuNzk1IDg0LjAxNjEgMjY1LjM4IDg0LjAxNjEgMjY3LjgyMSA2OS43NDc1QzI2Ny44NiA2OS43MzA5IDI2Ny44NzkgNjkuNTg3NyAyNjcuODc5IDY5LjMxNzkgMjY3Ljg3OSA2Ny4xMTgyIDI2Ni40NDggNjYuMDE4MyAyNjMuNTg2IDY2LjAxODNaTTI2My41NzYgODYuMDU0N0MyNjEuMDQ5IDg2LjA1NDcgMjU5Ljc4NiA4Ny4zMDA1IDI1OS43ODYgODkuNzkyMSAyNTkuNzg2IDkyLjI4MzcgMjYxLjA0OSA5My41Mjk1IDI2My41NzYgOTMuNTI5NSAyNjYuMTE2IDkzLjUyOTUgMjY3LjM4NyA5Mi4yODM3IDI2Ny4zODcgODkuNzkyMSAyNjcuMzg3IDg3LjMwMDUgMjY2LjExNiA4Ni4wNTQ3IDI2My41NzYgODYuMDU0N1oiIGZpbGw9IiNGRkU1MDAiIGZpbGwtcnVsZT0iZXZlbm9kZCIvPjwvZz48L3N2Zz4=) no-repeat 1rem/1.8rem, #b32121;
    padding: 1rem 1rem 1rem 3.7rem;
    color: white;
}

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

/* Blazor's unhandled-error bar. This MUST live in a global stylesheet, not a component-scoped
   *.razor.css: the element is a framework-owned singleton that blazor.web.js finds by id, and it is
   rendered separately by BOTH MainLayout and CheckoutLayout. Scoped CSS is rewritten to
   `#blazor-error-ui[b-<hash>]`, so a rule in one layout's stylesheet cannot match the other layout's
   copy — which left `display: none` unapplied on checkout pages and the bar permanently visible. */
#blazor-error-ui {
    color-scheme: light only;
    background: lightyellow;
    bottom: 0;
    box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2);
    box-sizing: border-box;
    display: none;
    left: 0;
    padding: 0.6rem 1.25rem 0.7rem 1.25rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
}

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

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

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

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

/* ==========================================================================================
   Colour mode
   ==========================================================================================
   The switch itself lives in swan-theme.js (which sheet applies) — these are the few places the
   Blazor project template hardcoded a light-only colour, plus the toggle button's own styling.
   Global on purpose: ThemeToggle is its own component, so a sheet scoped to whatever hosts it could
   reach neither the button nor the icons FeatherIcon renders inside it.

   The button now renders as a row in the sidebar's footer, and NavMenu.razor.css's .sidebar-footer-row
   rules out-specify the padding and colour below. What still comes from here is the button reset
   (background/border/cursor), the focus ring, and — the part that matters — the two-state switching. */

.theme-toggle {
    background: none;
    border: 0;
    padding: 0.5rem 0.65rem;
    color: var(--bs-secondary-color);
    line-height: 1;
    cursor: pointer;
}

.theme-toggle:hover {
    color: var(--bs-body-color);
}

.theme-toggle:focus-visible {
    outline: 2px solid var(--bs-primary);
    outline-offset: 2px;
}

.theme-toggle-icon {
    width: 18px;
    height: 18px;
    vertical-align: middle;
}

/* Show only the icon AND label for the mode you can switch TO, so the row reads as an action rather than as
   a statement of the current mode. Both states ship in the markup and this hides one — which is why nothing
   in ThemeToggle.razor may set `display` on the .theme-toggle-moon/.theme-toggle-sun elements: at (0,2,1)
   this rule loses to almost any class-based `display`, and both states would show at once. */
html[data-bs-theme="dark"] .theme-toggle-moon,
html:not([data-bs-theme="dark"]) .theme-toggle-sun {
    display: none;
}

/* Semantic ink/tint palette.
   ---------------------------------------------------------------------------------------------
   Bootstrap's own `*-text-emphasis` / `*-bg-subtle` families CANNOT be used for this: AppStack's
   dark build never dark-ified them, so under dark.css they are still light-ground values
   (--bs-warning-text-emphasis is #523816, a near-black brown, against a #202634 page). Anything
   styled with them is unreadable in dark mode. These tokens are the replacement — every value is
   contrast-checked against the ground it appears on, and they are the ONLY semantic text/tint
   colours app CSS should reach for.

   Base `--bs-warning` / `--bs-success` are fine in both modes and stay in use for solid marks
   (gauge ticks, severity stripes): AppStack ships them vivid (#e5a54b / #4bbf73).

   `--swan-surface` is the "raised above the page ground" colour — what a .card gets. AppStack only
   defines --bs-card-bg inside the .card rule itself, so chrome that has to match a card without
   being one (the checkout header bar) cannot read it and needs this token instead. The page ground
   underneath is plain `--bs-body-bg`, which both builds define correctly. */
:root {
    --swan-surface: #fff;        /* = AppStack light's --bs-card-bg */
    --swan-surface-line: #e6e9f0;
    --swan-ok-ink: #16603c;      /* ~7:1 on white */
    --swan-ok-tint: #dcefe5;
    --swan-ok-line: #9fd3b4;
    --swan-warn-ink: #8a4a12;    /* ~7.5:1 on white */
    --swan-warn-tint: #f6e7d8;
    --swan-warn-line: #e3b782;
    --swan-bad-ink: #a12a2a;     /* ~7:1 on white. Only for a check that ran and failed. */
    --swan-bad-tint: #f8e1e1;
    --swan-bad-line: #e2a5a5;
    --swan-info-ink: #0c405a;
    --swan-info-tint: #d3e8f6;
    --swan-info-line: #a4d1ea;
    --swan-accent-ink: #1f5fd0;  /* #2f6fed measured 4.31:1 — under AA on the page ground */
    --swan-code-ink: #9c3f6a;
}

html[data-bs-theme="dark"] {
    --swan-surface: #293042;     /* = AppStack dark's --bs-card-bg */
    --swan-surface-line: #3e4555;
    --swan-ok-ink: #7ddba4;      /* ~9:1 on the #202634 page */
    --swan-ok-tint: #14321f;
    --swan-ok-line: #245c37;
    --swan-warn-ink: #e6b566;    /* ~7:1 */
    --swan-warn-tint: #37290f;
    --swan-warn-line: #6b4f1c;
    --swan-bad-ink: #f29191;     /* ~7:1 on the #202634 page */
    --swan-bad-tint: #3a1b1d;
    --swan-bad-line: #6e3236;
    --swan-info-ink: #7fc8ec;
    --swan-info-tint: #12303f;
    --swan-info-line: #245b74;
    --swan-accent-ink: #6ea8fe;
    --swan-code-ink: #e685ad;    /* --bs-code-color's #e83e8c glares on the dark ground */
}

/* Content links only. The sidebar keeps its own dark ground in BOTH modes, so its links and brand
   must not follow the page link colour — a blanket `a` rule here painted them blue. */
html[data-bs-theme="dark"] :is(main, .main, .content, .card, .modal) a:not(.btn):not(.sidebar-link),
html[data-bs-theme="dark"] .btn-link {
    color: var(--swan-accent-ink);
}

html[data-bs-theme="dark"] code {
    color: var(--swan-code-ink);
}

html[data-bs-theme="dark"] .btn:focus,
html[data-bs-theme="dark"] .btn:active:focus,
html[data-bs-theme="dark"] .btn-link.nav-link:focus,
html[data-bs-theme="dark"] .form-control:focus,
html[data-bs-theme="dark"] .form-check-input:focus {
    box-shadow: 0 0 0 0.1rem var(--bs-body-bg), 0 0 0 0.25rem #258cfb;
}

html[data-bs-theme="dark"] .validation-message,
html[data-bs-theme="dark"] .invalid {
    /* #e50000 fails contrast on a dark ground. */
    color: #ff8a84;
}

html[data-bs-theme="dark"] .invalid {
    outline-color: #ff8a84;
}

/* ==========================================================================================
   Centred sign-in shell — /account/login
   ==========================================================================================
   The page used to carry `min-height: 100vh; background: #f5f7fb` inline (so did the since-removed
   /auth/trusted-login hand-off, which shared this class). The literal ground stayed pale under
   dark.css while the card went dark, so the card floated on a light void. No background of its own on purpose —
   the page ground belongs to the layout (.content), so this follows the colour mode for free.

   The 100vh went with it: this sits INSIDE .content, which already starts below the ~63px top bar
   and adds 1.5rem of padding top and bottom, so a full viewport height overflowed by just over
   7rem and put a scrollbar on a page that has nothing to scroll — enough that focusing the email
   field scrolled the top bar out of sight. 7rem is that chrome, so the shell fills what is left. */

.auth-shell {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: calc(100vh - 7rem);
}

.auth-card {
    width: 100%;
    max-width: 420px;
}
/* ==========================================================================================
   Write-only secret inputs — admin config, NOT sign-in
   ==========================================================================================
   Processor passwords, API keys and webhook secrets are `type="text"` masked by CSS rather than
   `type="password"`. That looks backwards, so: a password field is exactly what makes a browser's
   password manager classify the surrounding form as a login form. Having done so it fills the
   nearest preceding text input with the saved username and the password field with the saved
   password — which put the operator's own `lgadmin@…` address into "Payment Processor Username"
   and their admin password into "Payment Processor API Key". `autocomplete="off"` and
   `autocomplete="new-password"` were both ignored; they are advisory, and Chrome overrides them
   when its own heuristics disagree. Removing the password field removes the signal itself, which
   is the only part of this that a browser cannot override.

   The cost is narrow because these fields are write-only: every one of them renders BLANK (a
   stored secret is never shown back), so masking only ever covers what is being typed right now,
   never anything at rest.

   -webkit-text-security covers Chromium and WebKit. Firefox has never shipped it or an equivalent,
   so a secret being typed there shows in clear — the trade is deliberate: a value visible while
   an operator types it is a smaller problem than an admin credential silently saved as a
   merchant's processor password. Revisit if the standard `input-security` property ships.

   The password field on the real sign-in form is untouched and stays `type="password"` with
   `autocomplete="current-password"` — that form IS a login, and the password manager should work
   there. Marking it correctly is also what stops the heuristics reaching for other forms. */

.secret-input {
    -webkit-text-security: disc;
}

/* ==========================================================================================
   Tabs: one look for every tab strip and status filter in the admin
   ==========================================================================================
   Transactions, Users, Sites, the Alert log, a trusted app's page and Email templates each had their
   own tab style, mostly a thin underline or a faint outline that was hard to pick out, worst in dark
   mode. This is the shared one: a visible track, the selected tab filled solid, the others in full ink.

   Measured: light, white on #2b63c2 is 5.7:1 and the fill is 4.8:1 against the track; dark, #0f1a2b
   on #6ea8fe is 7.2:1 and the fill is 6.5:1 against the track. Counts ride inside the tab and
   switch colour with it. Use .swan-tab-count--warn for a count that means "go look". */
:root {
    --swan-tab-track: #e9eef6;
    --swan-tab-track-line: #d5dce8;
    --swan-tab-ink: #1b2333;
    --swan-tab-hover: #dce4f1;
    --swan-tab-on-bg: #2b63c2;
    --swan-tab-on-ink: #ffffff;
    --swan-tab-count-bg: #ffffff;
    --swan-tab-count-ink: #414b5c;
}

html[data-bs-theme="dark"] {
    --swan-tab-track: #1d2431;
    --swan-tab-track-line: #343d4d;
    --swan-tab-ink: #e8edf5;
    --swan-tab-hover: #2a3445;
    --swan-tab-on-bg: #6ea8fe;
    --swan-tab-on-ink: #0f1a2b;
    --swan-tab-count-bg: #2f3a4d;
    --swan-tab-count-ink: #d3dae5;
}

.swan-tabs {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 0.25rem;
    padding: 0.25rem;
    margin-bottom: 0.875rem;
    background: var(--swan-tab-track);
    border: 1px solid var(--swan-tab-track-line);
    border-radius: 0.6rem;
    max-width: 100%;
}

.swan-tab {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.4rem 0.85rem;
    border: 0;
    border-radius: 0.45rem;
    background: transparent;
    color: var(--swan-tab-ink);
    font-size: 0.875rem;
    font-weight: 500;
    line-height: 1.3;
    white-space: nowrap;
    cursor: pointer;
    transition: background-color 0.12s ease, color 0.12s ease;
}

.swan-tab:hover {
    background: var(--swan-tab-hover);
}

.swan-tab:focus-visible {
    outline: 2px solid var(--swan-tab-on-bg);
    outline-offset: 2px;
}

.swan-tab.is-active,
.swan-tab[aria-selected="true"],
.swan-tab[aria-pressed="true"] {
    background: var(--swan-tab-on-bg);
    color: var(--swan-tab-on-ink);
    font-weight: 600;
    box-shadow: 0 1px 2px rgba(15, 26, 43, 0.25);
}

.swan-tab-count {
    min-width: 1.4rem;
    padding: 0.05rem 0.45rem;
    border-radius: 999px;
    background: var(--swan-tab-count-bg);
    color: var(--swan-tab-count-ink);
    font-size: 0.75rem;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    text-align: center;
}

.swan-tab.is-active .swan-tab-count,
.swan-tab[aria-selected="true"] .swan-tab-count,
.swan-tab[aria-pressed="true"] .swan-tab-count {
    background: rgba(255, 255, 255, 0.22);
    color: inherit;
}

html[data-bs-theme="dark"] .swan-tab.is-active .swan-tab-count,
html[data-bs-theme="dark"] .swan-tab[aria-selected="true"] .swan-tab-count,
html[data-bs-theme="dark"] .swan-tab[aria-pressed="true"] .swan-tab-count {
    background: rgba(15, 26, 43, 0.18);
}

.swan-tab-count--warn {
    background: var(--swan-warn-tint);
    color: var(--swan-warn-ink);
    box-shadow: inset 0 0 0 1px var(--swan-warn-line);
}

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

/* ==========================================================================================
   Save bar: the sticky footer on a settings page (Fees, Reconciliation)
   ==========================================================================================
   Says whether anything is unsaved, lists each change as old value then new, and holds Discard and
   Save. Both buttons stay disabled until something changes, so an operator never re-saves the
   platform-wide schedule by accident. */

.swan-savebar {
    position: sticky;
    bottom: 0;
    z-index: 5;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem 1.5rem;
    margin: 0.5rem 0 2rem;
    padding: 0.85rem 1rem;
    background: var(--swan-surface);
    border: 1px solid var(--swan-surface-line);
    border-radius: 0.6rem 0.6rem 0 0;
    /* It sits on the bottom edge over the form while there is more page below it, so the shadow goes up. */
    box-shadow: 0 -8px 22px -12px rgba(15, 23, 42, 0.55);
}

.swan-savebar.is-dirty {
    border-color: var(--swan-info-line);
}

.swan-savebar-text {
    font-size: 0.88rem;
    color: var(--bs-secondary-color);
    min-width: 0;
}

.swan-savebar.is-dirty .swan-savebar-text {
    color: var(--bs-body-color);
}

.swan-savebar-changes {
    margin: 0.2rem 0 0;
    padding-left: 1.1rem;
    font-size: 0.84rem;
    font-variant-numeric: tabular-nums;
}

.swan-savebar-changes s {
    color: var(--bs-secondary-color);
}

.swan-savebar-actions {
    display: flex;
    gap: 0.5rem;
    margin-left: auto;
}

/* ==========================================================================================
   Notices: Bootstrap .alert, as every admin page shows "Saved" / "Couldn't..." after an action
   ==========================================================================================
   Two things AppStack gets wrong here.

   The close button keeps Bootstrap's full-height padding, sized for a default-height alert. The pages use
   the slimmer py-2 alert, so the X stood taller than the bar, pinned to its top edge and spilling out
   below. The alert also had no right padding, so a long message could run under the X. Below: the X is
   centred on the bar, and the message stops short of it.

   In dark mode AppStack paints a solid mid-green slab with a mint border, which shouts louder than anything
   else on the page, and leaves the X at half opacity. Dark mode now uses the same tint / line / ink tokens
   as the status text elsewhere, and the X is easier to see. */

.alert-dismissible {
    padding-right: 2.75rem;
}

.alert-dismissible .btn-close {
    top: 50%;
    right: 0.6rem;
    transform: translateY(-50%);
    padding: 0.35rem;
}

html[data-bs-theme="dark"] .alert-success   { --swan-alert-tint: var(--swan-ok-tint);   --swan-alert-line: var(--swan-ok-line);   --swan-alert-ink: var(--swan-ok-ink); }
html[data-bs-theme="dark"] .alert-warning   { --swan-alert-tint: var(--swan-warn-tint); --swan-alert-line: var(--swan-warn-line); --swan-alert-ink: var(--swan-warn-ink); }
html[data-bs-theme="dark"] .alert-danger    { --swan-alert-tint: var(--swan-bad-tint);  --swan-alert-line: var(--swan-bad-line);  --swan-alert-ink: var(--swan-bad-ink); }
html[data-bs-theme="dark"] .alert-info      { --swan-alert-tint: var(--swan-info-tint); --swan-alert-line: var(--swan-info-line); --swan-alert-ink: var(--swan-info-ink); }

/* .alert twice-qualified on purpose: AppStack's dark fill is `.alert-success:not(.alert-outline):not(...)`,
   three classes deep, and a two-class selector here loses to it. */
html[data-bs-theme="dark"] .alert:is(.alert-success, .alert-warning, .alert-danger, .alert-info) {
    background: var(--swan-alert-tint);
    border-color: var(--swan-alert-line);
    /* The ink tokens are measured at 7:1 or better against their own tint, so the whole message can carry
       the tone; muted body grey on the dark tint read as disabled. */
    color: var(--swan-alert-ink);
}

/* AppStack's dark theme already draws the X in white (no filter needed). It only needs more opacity than
   Bootstrap's 0.5 to show on the darker tint. */
html[data-bs-theme="dark"] .alert .btn-close {
    opacity: 0.75;
}

html[data-bs-theme="dark"] .alert .btn-close:hover {
    opacity: 1;
}

/* Home page tile icons (FeatherIcon): a little larger than the 24px default. */
.home-tile-icon {
    width: 28px;
    height: 28px;
}
