html {
  font-size: 14px;
}

@media (min-width: 768px) {
  html {
    font-size: 16px;
  }
}

.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;
}

html {
  position: relative;
  min-height: 100%;
}

body {
  margin-bottom: 90px;
}

[data-bs-theme=light] h3 {
    color: #005d83;
}

/* Page headings on the account pages that use the theme's Layout-Login
   (.auth-wrapper): Log in, Register, Forgot password, Reset password, their
   confirmation pages, and Registration pending. The headings come from
   Orchard's built-in views as a mix of <h1> and <h2>. Same treatment as the
   h3 rule above: brand color in light mode, theme default in dark mode,
   matching "Patient Criteria" on the main page. */
[data-bs-theme=light] .auth-wrapper h1,
[data-bs-theme=light] .auth-wrapper h2 {
    color: #005d83;
}

/* reCAPTCHA box on the Log in and Register pages. Orchard's reCAPTCHA tag
   helper renders a bare <div class="g-recaptcha"> with no margin, so the
   submit button below it sat flush against the box. 1rem matches the
   Bootstrap mb-3 spacing between the form fields above it. */
.g-recaptcha {
    margin-bottom: 1rem;
}

/* --- Brand palette ---------------------------------------------------
   --pal-brand is the fixed brand color. --pal-accent is the readable
   text/border accent for the active theme: the brand color in light mode,
   lightened in dark mode where #005d83 is too dark to read. Buttons and
   panel section headings both draw from --pal-accent so they stay matched. */
:root {
    --pal-brand: #005d83;
    --pal-brand-hover: #004f6f;  /* 85% of brand, matching the theme's own hover step */
    --pal-brand-active: #004a69;  /* 80% of brand */
    --pal-accent: #005d83;
    --pal-accent-rgb: 0, 93, 131;
}

/* Links use the brand accent in both themes. The theme's light-mode link
   color is indigo (#624bff), and its `a` rule reads the -rgb token, so both
   the hex and -rgb tokens are re-pointed. The selector matches the theme's
   own `:root,[data-bs-theme=light]` block, so loading site.css after
   theme.min.css decides the winner. Brand on white is ~7:1, which passes
   WCAG AA. Dark mode re-points these again below. */
:root,
[data-bs-theme=light] {
    --dashui-link-color: var(--pal-accent);
    --dashui-link-color-rgb: var(--pal-accent-rgb);
    --dashui-link-hover-color: var(--pal-brand-hover);
    --dashui-link-hover-color-rgb: 0, 79, 111;
}

[data-bs-theme=dark] {
    --pal-accent: #5cc0e6;
    --pal-accent-rgb: 92, 192, 230;
    --pal-accent-hover: #4ea3c4;  /* 85% of accent, matching the brand's own hover step */
    --pal-accent-active: #4a9ab8;  /* 80% of accent */

    /* The theme's dark-mode link color (--dashui-link-color/-rgb, consumed by
       `a`, `.btn-link` and `.nav`) is a bright indigo/violet (#a193ff), the
       same family as the default button indigo. Re-pointing it to
       --pal-accent keeps links in the blue family and matched to the rest
       of the dark palette, while still clearing WCAG AA (~8.6:1 against the
       page background, well past the 4.5:1 text minimum). */
    --dashui-link-color: var(--pal-accent);
    --dashui-link-color-rgb: var(--pal-accent-rgb);
    --dashui-link-hover-color: var(--pal-accent-hover);
    --dashui-link-hover-color-rgb: 78, 163, 196;
}

/* Solid primary. Setting background-color directly only wins the resting
   state - the theme's `.btn:hover` and `.btn.active` rules are more specific
   and would pull the indigo hover/active tokens back in, so these have to be
   overridden as tokens too. */
.btn-primary {
    --dashui-btn-bg: var(--pal-brand);
    --dashui-btn-border-color: var(--pal-brand);
    --dashui-btn-hover-bg: var(--pal-brand-hover);
    --dashui-btn-hover-border-color: var(--pal-brand-active);
    --dashui-btn-active-bg: var(--pal-brand-active);
    --dashui-btn-active-border-color: var(--pal-brand-active);
    --dashui-btn-focus-shadow-rgb: 51, 125, 156;
    --dashui-btn-disabled-bg: var(--pal-brand);
    --dashui-btn-disabled-border-color: var(--pal-brand);
}

/* The theme defines its own [data-bs-theme=dark] .btn-primary block that
   hard-codes the indigo tokens, which outranks the plain .btn-primary rule
   above on specificity alone. Re-declaring at the same specificity here
   lets cascade order (site.css after theme.min.css) decide the winner.
   This uses --pal-accent rather than --pal-brand: the brand teal only hits
   ~2.5:1 against the dark page background (fails the WCAG 1.4.11 3:1
   non-text minimum), same reason --pal-accent exists for text/borders. */
[data-bs-theme=dark] .btn-primary {
    --dashui-btn-color: #0f172a;
    --dashui-btn-bg: var(--pal-accent);
    --dashui-btn-border-color: var(--pal-accent);
    --dashui-btn-hover-color: #0f172a;
    --dashui-btn-hover-bg: var(--pal-accent-hover);
    --dashui-btn-hover-border-color: var(--pal-accent-active);
    --dashui-btn-active-color: #0f172a;
    --dashui-btn-active-bg: var(--pal-accent-active);
    --dashui-btn-active-border-color: var(--pal-accent-active);
    --dashui-btn-focus-shadow-rgb: var(--pal-accent-rgb);
    --dashui-btn-disabled-color: #0f172a;
    --dashui-btn-disabled-bg: var(--pal-accent);
    --dashui-btn-disabled-border-color: var(--pal-accent);
}

/* The DashUI theme drives outline buttons entirely through --dashui-btn-*
   custom properties, so re-pointing the tokens recolors the resting, hover,
   active, focus-ring and disabled states together. */
.btn-outline-primary {
    --dashui-btn-color: var(--pal-accent);
    --dashui-btn-border-color: var(--pal-accent);
    --dashui-btn-hover-bg: var(--pal-brand);
    --dashui-btn-hover-border-color: var(--pal-brand);
    --dashui-btn-active-bg: var(--pal-brand);
    --dashui-btn-active-border-color: var(--pal-brand);
    --dashui-btn-focus-shadow-rgb: var(--pal-accent-rgb);
    --dashui-btn-disabled-color: var(--pal-accent);
    --dashui-btn-disabled-border-color: var(--pal-accent);
}

/* In dark mode the hover fill uses the light accent with dark text,
   so the border colour doesn't jump between states. */
[data-bs-theme=dark] .btn-outline-primary {
    --dashui-btn-hover-color: #0f172a;
    --dashui-btn-hover-bg: var(--pal-accent);
    --dashui-btn-hover-border-color: var(--pal-accent);
    --dashui-btn-active-color: #0f172a;
    --dashui-btn-active-bg: var(--pal-accent);
    --dashui-btn-active-border-color: var(--pal-accent);
}

/* Documentation links (Getting Started / Instructor Guide) */
.btn-doc {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    padding: .35rem .75rem;
    font-size: .875rem;
    font-weight: 500;
    line-height: 1.4;
    color: var(--pal-accent);
    background-color: rgba(var(--pal-accent-rgb), .08);
    border: 1px solid transparent;
    border-radius: .375rem;
    text-decoration: none;
    transition: background-color .15s ease-in-out;
}

.btn-doc:hover,
.btn-doc:focus-visible {
    color: var(--pal-accent);
    background-color: rgba(var(--pal-accent-rgb), .16);
}

.btn-doc .doc-ext {
    font-size: .75em;
    opacity: .65;
}

[data-bs-theme=dark] .btn-doc {
    background-color: rgba(var(--pal-accent-rgb), .12);
}

[data-bs-theme=dark] .btn-doc:hover,
[data-bs-theme=dark] .btn-doc:focus-visible {
    background-color: rgba(var(--pal-accent-rgb), .22);
}

/* "Select…" placeholder option: show it in the same muted color as text
   input placeholders while it is the chosen value, but keep the options
   in the open dropdown list at normal text color. */
.form-select:has(option[value=""]:checked) {
    color: var(--dashui-input-placeholder-color);
}

.form-select option {
    color: var(--dashui-body-color);
}

/* Results panel prompt, shown before any criteria are entered */
.results-prompt-icon {
    font-size: 2.5rem;
    color: var(--pal-accent);
    opacity: .6;
}

/* Section headings in the Patient Criteria panel (Patient, Prescription,
   Lifestyle). Dark mode only - light mode keeps the theme's grey. The
   theme sets .text-secondary to a hard-coded `color:#475569!important`,
   so beating it needs !important at higher specificity. */
[data-bs-theme=dark] .criteria-section-title {
    color: var(--pal-accent) !important;
}