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

/* b-op's blue, set as Bootstrap's own LINK VARIABLE rather than as a colour on the elements: the
   variable is what .btn-link, .nav-link and everything else here already reads, and setting it per
   theme is what lets the dark theme keep its own lighter blue. The colour itself was hard-coded on
   `a, .btn-link` before, so every link in the content read as a dark blue on a dark page - about
   2.4:1, which is unreadable rather than merely dim. */
html[data-bs-theme="light"] {
    --bs-link-color: #006bb7;
    --bs-link-color-rgb: 0, 107, 183;
    --bs-link-hover-color: #005a9b;
    --bs-link-hover-color-rgb: 0, 90, 155;
}

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

/* The inner ring is the PAGE's colour, not white. It is there to separate the blue focus ring from
   whatever the control sits on, so on a dark page a white one is a bright halo around every box
   somebody clicks into - the most visible thing on the screen, and the one nobody asked for. */
.btn:focus, .btn:active:focus, .btn-link.nav-link:focus, .form-control:focus, .form-check-input:focus {
  box-shadow: 0 0 0 0.1rem var(--bs-body-bg), 0 0 0 0.25rem #258cfb;
}

/* A little more than the 1.1rem this had while a 3.5rem chrome bar sat above it: the content is
   now the first thing on the page, and a heading against the top edge of the window reads as a
   page that has been cut off. */
.content {
    padding-top: 1.5rem;
}

.login-box {
    margin-top: 2rem;
}

h1:focus {
    outline: none;
}

/* Validation, in Bootstrap's own theme-aware form tokens rather than in fixed greens and reds:
   both flip with the theme (#198754/#dc3545 on light, #75b798/#ea868f on dark), so a refused field
   reads the same way in either and does not turn into a dark red on a dark page. */
.valid.modified:not([type=checkbox]) {
    outline: 1px solid var(--bs-form-valid-border-color);
}

.invalid {
    outline: 1px solid var(--bs-form-invalid-border-color);
}

.validation-message {
    color: var(--bs-form-invalid-color);
}

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

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

/* A checkbox whose border is stronger than Bootstrap's default, because an unticked box on a plain
   background is easy to miss. Taken from the theme's own emphasis colour at half strength rather
   than fixed at #929292: that grey is a reasonable line on white and nearly invisible on #212529,
   which is exactly the kind of thing this file should not decide for itself. */
.darker-border-checkbox.form-check-input {
    border-color: rgba(var(--bs-emphasis-color-rgb), 0.45);
}

.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;
}

/* Dark-mode switch: an entry of the Account/Settings flyout, matching the Logout button beside it
   rather than the floating icon button it used to be in the top row. The menu's own .nav-link
   colours come from the scoped sidebar stylesheet; what is set here is only what makes a <button>
   sit like the anchors around it. */
#theme-toggle.theme-toggle-btn {
    display: flex;
    align-items: center;
    width: 100%;
    background: none;
    border: 0;
    font: inherit;
    text-align: left;
    white-space: nowrap;
    cursor: pointer;
}

/* The two SVGs ride in .bi spans so they take the same 1.25rem box and 0.75rem gutter every other
   menu icon has - the sidebar sets those on .bi, and an <svg> on its own would not line up. */
#theme-toggle .theme-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background-image: none;
}

/* Which icon and which words show follows data-bs-theme on <html> - set before first paint by the
   inline script in App.razor's <head> - so the entry reads correctly on the very first render
   rather than after the circuit connects and can tell the component what the theme is. A sun and
   "Switch to dark mode" while light is active; a moon and "Switch to light mode" while dark is. */
#theme-toggle .theme-icon-dark,
#theme-toggle .theme-label-dark {
    display: none;
}

html[data-bs-theme="dark"] #theme-toggle .theme-icon-light,
html[data-bs-theme="dark"] #theme-toggle .theme-label-light {
    display: none;
}

html[data-bs-theme="dark"] #theme-toggle .theme-icon-dark {
    display: inline-flex;
}

html[data-bs-theme="dark"] #theme-toggle .theme-label-dark {
    display: inline;
}

/* A theme that applied but could not be saved to the profile: said inside the flyout, in the one
   place the click happened, rather than as a page-level banner nobody would connect to it. */
.theme-toggle-error {
    padding: 0 0.75rem 0.4rem;
    color: #f7b1b7;
    font-size: 0.75rem;
    white-space: normal;
}

/* Deployment logs and config-file views: wrap long lines within their own box instead of forcing
   the whole page to scroll horizontally, and cap the height so a long log stays scrollable in
   place - keeps this readable regardless of how wide the browser window is. */
.deployment-log,
.config-file-content {
    white-space: pre-wrap;
    word-break: break-word;
    overflow-x: auto;
    max-height: 32rem;
    overflow-y: auto;
}
/* The compiler's own output, shown as it is after a failed build: long, wide, and worth keeping
   inside its own box rather than letting it stretch the page. */
.build-output {
    max-height: 20rem;
    overflow: auto;
    white-space: pre-wrap;
    word-break: break-word;
}

/* A row that was just saved, marked for a moment and then let go: green washes out to whatever the
   table background is in the theme in force (light or dark), so nothing is left behind. Bootstrap's
   --bs-success-rgb follows the theme, and fading to transparent means the row never has to know
   what colour it sits on. */
@keyframes just-saved-fade {
    from {
        background-color: rgba(var(--bs-success-rgb), 0.4);
    }
    to {
        background-color: transparent;
    }
}

.row-just-saved > * {
    animation: just-saved-fade 3.5s ease-out forwards;
}

/* ---------------------------------------------------------------------------------------------
   DISABLED AND READ-ONLY, decided here rather than inherited by accident.

   This application says "you may look but not change" with the `disabled` attribute and almost
   nothing else - 320 controls carry it, and a session without git credentials of its own has the
   whole UI in that state. So what a disabled control LOOKS like is not a detail: it is most of
   what such a session sees.

   Bootstrap's own disabled rules are theme-aware, but they stop short in two ways that show up on
   a dark page. A disabled .form-control keeps the full body text colour, so it reads as an
   ordinary field somebody simply cannot type in; and the outline buttons keep a FIXED #6c757d as
   their disabled colour, which is a reasonable grey on white and about 3:1 on #212529. Both are
   set below in theme tokens, so a disabled thing is quieter than an enabled one by the same amount
   in either theme, and legible in both.
   --------------------------------------------------------------------------------------------- */

/* .form-control-plaintext is deliberately NOT here: it is a value shown as plain text inside a
   form, borderless on purpose, and giving it a box would be changing what it is rather than
   fixing how it is coloured. Its colour comes from the body, which flips already. */
.form-control:disabled,
.form-select:disabled,
.form-control[readonly] {
    /* --bs-secondary-bg is #e9ecef on light and #343a40 on dark: a shade off the page either way,
       which is what says "not yours to change" without inventing a colour. */
    background-color: var(--bs-secondary-bg);
    color: var(--bs-secondary-color);
    border-color: var(--bs-border-color);
    opacity: 1;
}

/* An outline button is the Cancel, the Back and every row command here, so its disabled state is
   the one seen most often. --bs-tertiary-color is the theme's own "quieter than secondary": about
   4.3:1 on white and 5:1 on #212529, where the fixed grey managed 4.6 and 3.2. */
.btn[class*="btn-outline-"] {
    --bs-btn-disabled-color: var(--bs-tertiary-color);
    --bs-btn-disabled-border-color: var(--bs-border-color);
}

/* A group of controls that is off as a whole - the node-type chooser of the permission tree, the
   tab strips - reads as one quiet block rather than as buttons that happen to be grey each. */
.btn-group .btn:disabled,
.btn-group .btn.disabled {
    background-color: var(--bs-secondary-bg);
}

/* A fieldset used as a group box: its border and legend follow the theme like everything else, and
   when the group is off as a whole the legend says so too rather than staying at full strength. */
fieldset:disabled legend,
fieldset:disabled .form-text {
    color: var(--bs-tertiary-color);
}
