/*
    The visual system: one sheet, which the modules use without writing colours by hand. Bootstrap's
    own variables are redefined here, so its components follow without touching a page.

    Yellow is used as an accent only: for the brand, the active navigation marker and the focus ring.
    Never for buttons or status. Bootstrap's warning amber is already carrying "pendente" on holiday
    requests, and a yellow primary button sitting beside an amber pending badge would destroy that
    distinction.

    Fonts are self-hosted because the CSP allows only font-src 'self'; the licences are in fonts/.
*/
@font-face {
    font-family: 'Barlow';
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    src: url("fonts/barlow-latin-ext-400-normal.woff2") format("woff2");
    unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF;
}

@font-face {
    font-family: 'Barlow';
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    src: url("fonts/barlow-latin-400-normal.woff2") format("woff2");
    unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD;
}

@font-face {
    font-family: 'Barlow';
    font-style: normal;
    font-weight: 500;
    font-display: swap;
    src: url("fonts/barlow-latin-ext-500-normal.woff2") format("woff2");
    unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF;
}

@font-face {
    font-family: 'Barlow';
    font-style: normal;
    font-weight: 500;
    font-display: swap;
    src: url("fonts/barlow-latin-500-normal.woff2") format("woff2");
    unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD;
}

@font-face {
    font-family: 'Barlow';
    font-style: normal;
    font-weight: 600;
    font-display: swap;
    src: url("fonts/barlow-latin-ext-600-normal.woff2") format("woff2");
    unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF;
}

@font-face {
    font-family: 'Barlow';
    font-style: normal;
    font-weight: 600;
    font-display: swap;
    src: url("fonts/barlow-latin-600-normal.woff2") format("woff2");
    unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD;
}

@font-face {
    font-family: 'Barlow Semi Condensed';
    font-style: normal;
    font-weight: 500;
    font-display: swap;
    src: url("fonts/barlow-semi-condensed-latin-ext-500-normal.woff2") format("woff2");
    unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF;
}

@font-face {
    font-family: 'Barlow Semi Condensed';
    font-style: normal;
    font-weight: 500;
    font-display: swap;
    src: url("fonts/barlow-semi-condensed-latin-500-normal.woff2") format("woff2");
    unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD;
}

@font-face {
    font-family: 'Barlow Semi Condensed';
    font-style: normal;
    font-weight: 600;
    font-display: swap;
    src: url("fonts/barlow-semi-condensed-latin-ext-600-normal.woff2") format("woff2");
    unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF;
}

@font-face {
    font-family: 'Barlow Semi Condensed';
    font-style: normal;
    font-weight: 600;
    font-display: swap;
    src: url("fonts/barlow-semi-condensed-latin-600-normal.woff2") format("woff2");
    unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD;
}

:root {
    /* Brand */
    --bbs-yellow: #FFD800;
    --bbs-yellow-dark: #E6C200;
    --bbs-ink: #1F1B1B;
    --bbs-ink-soft: #38342D;

    /* Surfaces and text. Contrast of muted: 7.2:1 on white, 6.7:1 on the page background. */
    --bbs-muted: #5B5654;
    --bbs-ink-muted: #C9C4C0;
    --bbs-line: #DEDBD8;
    --bbs-field-line: #8E8986;
    --bbs-bg: #F7F7F6;

    /* Meanings, each as text on its own background. All clear AA; see StatusMap for their use. */
    --bbs-success: #146C43;
    --bbs-success-bg: #E3F3EA;
    --bbs-warning: #7A5200;
    --bbs-warning-bg: #FFF1CC;
    --bbs-danger: #B02A37;
    --bbs-danger-bg: #FBE4E6;
    --bbs-info: #0B5A8A;
    --bbs-info-bg: #E1F0FA;
    --bbs-neutral: #4B4646;
    --bbs-neutral-bg: #EEECEA;

    /* More surfaces. White is what cards, fields and modals paint with; --bbs-on-dark is text on
       ink or on a strong meaning colour. The -rgb triplets are for alpha only, as
       rgba(var(--bbs-ink-rgb), .15): shadows, scrims and tints, never a new colour. */
    --bbs-surface: #FFFFFF;
    --bbs-on-dark: #FFFFFF;
    --bbs-surface-rgb: 255, 255, 255;
    --bbs-ink-rgb: 31, 27, 27;
    --bbs-yellow-rgb: 255, 216, 0;
    /* Yellow tints: soft for a highlighted block or the days inside a chosen range, faint for a
       row that wants attention without shouting. Ink on soft is 15:1. */
    --bbs-yellow-soft: #FFF4B8;
    --bbs-yellow-faint: #FFFBE6;
    /* A line that has to show on the light neutral: chart axes, stripes, a swatch's edge. Not a
       field border (that is --bbs-field-line, which clears 3:1). */
    --bbs-line-strong: #C9C4BD;

    /* Categories: for things that are different kinds, not better or worse, where the meaning
       colours would say something false. Each has text on its own background (all 8:1 or more),
       a border line, and an accent for a stripe or a solid badge (white on it 5.4:1 or more,
       orange excepted: a stripe only, 3.9:1). Where they are used, they mean the same thing:
         teal = a levantamento (bike going out), violet = a devolução (bike coming back), in the
                agenda, the rental lists and Hoje;
         blue = a feriado on every holiday calendar, BGFit, a reunião, Messenger;
         green, purple, orange, pink = the remaining training areas and agenda categories
                (green nutrição / entrega, purple força / formação, orange bicicleta / evento,
                pink depilação / Instagram).
       Prefer telling them apart by lightness and the written label, never by hue alone. */
    --bbs-cat-blue: #0B5CD5;
    --bbs-cat-blue-text: #0A3977;
    --bbs-cat-blue-bg: #DDEBFF;
    --bbs-cat-blue-line: #A8C7F0;
    --bbs-cat-green: #146C43;
    --bbs-cat-green-text: #14532D;
    --bbs-cat-green-bg: #E6F4EA;
    --bbs-cat-green-line: #A7D7B6;
    --bbs-cat-purple: #6F42C1;
    --bbs-cat-purple-text: #3D1D68;
    --bbs-cat-purple-bg: #EFE3FB;
    --bbs-cat-purple-line: #C9AEEA;
    --bbs-cat-orange: #D05F0B;
    --bbs-cat-orange-text: #6B2C00;
    --bbs-cat-orange-bg: #FFE8D6;
    --bbs-cat-orange-line: #F2BF95;
    --bbs-cat-pink: #B02A6F;
    --bbs-cat-pink-text: #6D1338;
    --bbs-cat-pink-bg: #FDE4EE;
    --bbs-cat-pink-line: #F3B3CA;
    --bbs-cat-teal: #0F766E;
    --bbs-cat-teal-text: #0B4F4A;
    --bbs-cat-teal-bg: #E6F6F4;
    --bbs-cat-teal-line: #A3D9D2;
    --bbs-cat-violet: #7C3AED;
    --bbs-cat-violet-text: #4C1D95;
    --bbs-cat-violet-bg: #F1EBFE;
    --bbs-cat-violet-line: #CDB8F7;

    /* Rental reservation states: one set for the status badge, the lists and the calendar bars,
       so a state looks the same wherever it shows. Ink and yellow for the two that need someone to
       act; the closed ones greyed. */
    --bbs-rental-requested-bg: var(--bbs-surface);
    --bbs-rental-requested-fg: var(--bbs-ink);
    --bbs-rental-requested-line: var(--bbs-field-line);
    --bbs-rental-awaiting-bg: var(--bbs-yellow-soft);
    --bbs-rental-awaiting-fg: var(--bbs-ink);
    --bbs-rental-awaiting-line: var(--bbs-yellow-dark);
    --bbs-rental-confirmed-bg: var(--bbs-success);
    --bbs-rental-confirmed-fg: var(--bbs-on-dark);
    --bbs-rental-pickedup-bg: var(--bbs-ink);
    --bbs-rental-pickedup-fg: var(--bbs-yellow);
    --bbs-rental-returned-bg: var(--bbs-neutral-bg);
    --bbs-rental-returned-fg: var(--bbs-neutral);
    --bbs-rental-closed-bg: var(--bbs-bg);
    --bbs-rental-closed-fg: var(--bbs-muted);
    --bbs-rental-closed-line: var(--bbs-line);
    --bbs-rental-noshow-bg: var(--bbs-danger-bg);
    --bbs-rental-noshow-fg: var(--bbs-danger);

    /* Charts. The body-composition bar: fat in amber, lean mass in slate. */
    --bbs-chart-fat: #D9A441;
    --bbs-chart-fat-light: #EBCB8C;
    --bbs-chart-lean: #4A5D6E;

    /* The red of the paper BGFit form, kept on its printable sheets so they match it. 4.9:1. */
    --bbs-bgfit-red: #E4002B;

    /* Type */
    --bbs-font-body: 'Barlow', 'Helvetica Neue', Helvetica, Arial, sans-serif;
    --bbs-font-head: 'Barlow Semi Condensed', 'Barlow', 'Helvetica Neue', Helvetica, Arial, sans-serif;

    /* Spacing, in steps: 4 8 12 16 24 32. Card interior 12-16, between cards 12, between sections 24. */
    --bbs-space-1: .25rem;
    --bbs-space-2: .5rem;
    --bbs-space-3: .75rem;
    --bbs-space-4: 1rem;
    --bbs-space-5: 1.5rem;
    --bbs-space-6: 2rem;
    --bbs-radius: .5rem;

    /* Shadows only on what floats: sheets, menus and toasts. */
    --bbs-shadow: 0 4px 16px rgba(31, 27, 27, .18);

    /* The frame. --bbs-header-h is 52px plus the impersonation banner when there is one, kept up to
       date by js/page-actions.js. --bbs-bottom-nav-h is what fixed things at the bottom of a phone's
       screen have to stand clear of, safe area included. */
    --bbs-bar-h: 52px;
    --bbs-header-h: var(--bbs-bar-h);
    --bbs-bottom-nav-h: 0px;
    --bbs-rail-w: 64px;
    --bbs-sidebar-w: 220px;

    /* Bootstrap. --bs-body-bg stays white on purpose, because cards, tables, fields and modals all
       paint with it; body itself takes --bbs-bg below. */
    --bs-body-font-family: var(--bbs-font-body);
    --bs-body-font-size: .9375rem;
    --bs-body-line-height: 1.45;
    --bs-body-color: var(--bbs-ink);
    --bs-body-color-rgb: 31, 27, 27;
    --bs-heading-color: var(--bbs-ink);
    --bs-secondary-color: var(--bbs-muted);
    --bs-secondary-color-rgb: 91, 86, 84;
    --bs-border-color: var(--bbs-line);
    --bs-border-radius: var(--bbs-radius);
    --bs-border-radius-sm: .375rem;
    --bs-border-radius-lg: .625rem;
    --bs-link-color: var(--bbs-ink);
    --bs-link-color-rgb: 31, 27, 27;
    --bs-link-hover-color: var(--bbs-ink-soft);
    --bs-link-hover-color-rgb: 56, 52, 45;
    --bs-primary: var(--bbs-ink);
    --bs-primary-rgb: 31, 27, 27;
    --bs-success: var(--bbs-success);
    --bs-success-rgb: 20, 108, 67;
    --bs-danger: var(--bbs-danger);
    --bs-danger-rgb: 176, 42, 55;
    --bs-info: var(--bbs-info);
    --bs-info-rgb: 11, 90, 138;
    --bs-secondary: var(--bbs-muted);
    --bs-secondary-rgb: 91, 86, 84;
}

/* What fixed things stand clear of, and where the page's own scroll stops under the bars. */
@media (max-width: 767.98px) {
    :root {
        --bbs-bottom-nav-h: calc(56px + env(safe-area-inset-bottom, 0px));
    }
}

html {
    scroll-padding-top: calc(var(--bbs-header-h) + var(--bbs-space-2));
    scroll-padding-bottom: calc(var(--bbs-bottom-nav-h) + var(--bbs-space-2));
}

body {
    background-color: var(--bbs-bg);
    font-variant-numeric: lining-nums;
}

/* An open sheet covers the page; the page behind it does not slide. */
html:has(dialog[open]) {
    overflow: hidden;
}

/* Type scale: 28 / 20 / 16 / 15 / 13 / 12. */
h1, .h1, h2, .h2, h3, .h3, h4, .h4, h5, .h5, h6, .h6 {
    font-family: var(--bbs-font-head);
    font-weight: 600;
    color: var(--bbs-ink);
}

h1, .h1 {
    font-size: 1.75rem;
    line-height: 1.15;
}

h2, .h2 {
    font-size: 1.25rem;
    line-height: 1.2;
}

h3, .h3, h4, .h4, .h5, h5, h6, .h6 {
    font-size: 1rem;
    line-height: 1.3;
}

/* No 700 face is shipped; asked for one, the browser would pick 600 anyway. Said out loud so
   "bolder" and .fw-bold read the same everywhere. */
b, strong {
    font-weight: 600;
}

.fw-bold {
    font-weight: 600 !important;
}

small, .small {
    font-size: .8125rem;
}

.form-label {
    margin-bottom: var(--bbs-space-1);
    font-weight: 500;
}

/* Fixed figures wherever amounts and dates line up in columns. */
.table {
    --bs-table-border-color: var(--bbs-line);
    font-variant-numeric: lining-nums tabular-nums;
}

.table > thead th {
    font-size: .8125rem;
    font-weight: 600;
    color: var(--bbs-muted);
}

/* One card: white, a thin line, a plain title. No coloured headers. */
.card {
    --bs-card-border-color: var(--bbs-line);
    --bs-card-cap-bg: #fff;
    --bs-card-bg: #fff;
    --bs-card-spacer-y: .875rem;
    --bs-card-spacer-x: 1rem;
    --bs-card-cap-padding-y: .625rem;
    --bs-card-cap-padding-x: 1rem;
    --bs-card-border-radius: var(--bbs-radius);
    --bs-card-inner-border-radius: calc(var(--bbs-radius) - 1px);
}

.card-header {
    font-family: var(--bbs-font-head);
    font-weight: 600;
    font-size: 1rem;
}

.list-group {
    --bs-list-group-border-color: var(--bbs-line);
}

/* Bootstrap's badge is 11.25px, under the scale's 12px floor. */
.badge {
    --bs-badge-font-size: .75rem;
    --bs-badge-font-weight: 500;
}

.text-bg-warning {
    color: var(--bbs-warning) !important;
    background-color: var(--bbs-warning-bg) !important;
}

/* Same soft pair for info: with --bs-info darkened, Bootstrap's black text on it would fail. */
.text-bg-info {
    color: var(--bbs-info) !important;
    background-color: var(--bbs-info-bg) !important;
}

/* Bootstrap's amber is 1.6:1 as text on white. */
.text-warning {
    color: var(--bbs-warning) !important;
}

/* Bootstrap's own grey for a disabled field's label, 4.4:1 on the page background. */
.form-floating > :disabled ~ label,
.form-floating > .form-control:disabled ~ label {
    color: var(--bbs-muted);
}

/* The sliding box has to be what absolutely positioned content is measured against. Otherwise a
   .visually-hidden heading inside a wide table escapes the clipping, and a phone's browser widens
   the whole page, fixed bottom bar included, to fit it. */
.table-responsive {
    position: relative;
}

/* Alerts carry the same meanings as the status badges. */
.alert-success { --bs-alert-color: var(--bbs-success); --bs-alert-bg: var(--bbs-success-bg); --bs-alert-border-color: #B9DFC9; }
.alert-warning { --bs-alert-color: var(--bbs-warning); --bs-alert-bg: var(--bbs-warning-bg); --bs-alert-border-color: #F0DA9A; }
.alert-danger { --bs-alert-color: var(--bbs-danger); --bs-alert-bg: var(--bbs-danger-bg); --bs-alert-border-color: #F3C2C7; }
.alert-info { --bs-alert-color: var(--bbs-info); --bs-alert-bg: var(--bbs-info-bg); --bs-alert-border-color: #B7D9EF; }

.nav-pills {
    --bs-nav-pills-link-active-bg: var(--bbs-ink);
    --bs-nav-link-color: var(--bbs-ink);
    --bs-nav-link-hover-color: var(--bbs-ink);
}

/* Links are ink and underlined, as the PageHeader trail is: the brand has no blue, and the
   underline is what says "link" (colour alone would not, for anyone who cannot tell them apart).
   A link styled as a button keeps its button look; .btn-link is a link and looks like one. Alert
   links keep Bootstrap's own per-alert colour, which reads on that alert's background. */
a, .btn-link {
    color: var(--bbs-ink);
    text-decoration-line: underline;
    text-underline-offset: .15em;
}

a:hover, .btn-link:hover {
    color: var(--bbs-ink-soft);
    text-decoration-thickness: 2px;
}

.btn-link {
    --bs-btn-color: var(--bbs-ink);
    --bs-btn-hover-color: var(--bbs-ink-soft);
    --bs-btn-active-color: var(--bbs-ink);
    --bs-btn-disabled-color: var(--bbs-muted);
    --bs-btn-focus-shadow-rgb: var(--bbs-ink-rgb);
}

/* Ink ring with a yellow halo, the same pair as buttons and fields, so it shows on white, on the
   page background and on the dark frame alike. */
a:focus-visible, .btn-link:focus-visible {
    outline: 2px solid var(--bbs-ink);
    outline-offset: 1px;
    box-shadow: 0 0 0 5px var(--bbs-yellow);
    border-radius: .125rem;
}

/* Buttons. One primary per view; a secondary has ink text, never grey, because a grey outline
   reads as disabled. Primary actions take the brand's near-black rather than its yellow: white on
   #1F1B1B clears WCAG AA comfortably, whereas white on yellow does not. */
.btn {
    --bs-btn-font-size: .9375rem;
    --bs-btn-font-weight: 500;
}

.btn-sm, .btn-group-sm > .btn {
    --bs-btn-font-size: .875rem;
}

.btn-primary {
    --bs-btn-color: #fff;
    --bs-btn-bg: var(--bbs-ink);
    --bs-btn-border-color: var(--bbs-ink);
    --bs-btn-hover-color: #fff;
    --bs-btn-hover-bg: var(--bbs-ink-soft);
    --bs-btn-hover-border-color: var(--bbs-ink-soft);
    --bs-btn-active-color: #fff;
    --bs-btn-active-bg: var(--bbs-ink-soft);
    --bs-btn-active-border-color: var(--bbs-ink-soft);
    --bs-btn-disabled-color: #fff;
    --bs-btn-disabled-bg: var(--bbs-ink-soft);
    --bs-btn-disabled-border-color: var(--bbs-ink-soft);
}

.btn-outline-primary,
.btn-outline-secondary {
    --bs-btn-color: var(--bbs-ink);
    --bs-btn-border-color: var(--bbs-ink);
    --bs-btn-hover-color: #fff;
    --bs-btn-hover-bg: var(--bbs-ink);
    --bs-btn-hover-border-color: var(--bbs-ink);
    --bs-btn-active-color: #fff;
    --bs-btn-active-bg: var(--bbs-ink);
    --bs-btn-active-border-color: var(--bbs-ink);
    --bs-btn-disabled-color: var(--bbs-muted);
    --bs-btn-disabled-border-color: var(--bbs-field-line);
}

/* The pressed half of a toggle, as in Mês / Ano. */
.btn-secondary {
    --bs-btn-color: #fff;
    --bs-btn-bg: var(--bbs-ink);
    --bs-btn-border-color: var(--bbs-ink);
    --bs-btn-hover-color: #fff;
    --bs-btn-hover-bg: var(--bbs-ink-soft);
    --bs-btn-hover-border-color: var(--bbs-ink-soft);
    --bs-btn-active-color: #fff;
    --bs-btn-active-bg: var(--bbs-ink-soft);
    --bs-btn-active-border-color: var(--bbs-ink-soft);
}

.btn-danger {
    --bs-btn-bg: var(--bbs-danger);
    --bs-btn-border-color: var(--bbs-danger);
    --bs-btn-hover-bg: #8F1F2B;
    --bs-btn-hover-border-color: #8F1F2B;
    --bs-btn-active-bg: #8F1F2B;
    --bs-btn-active-border-color: #8F1F2B;
    --bs-btn-disabled-bg: var(--bbs-danger);
    --bs-btn-disabled-border-color: var(--bbs-danger);
}

.btn-outline-danger {
    --bs-btn-color: var(--bbs-danger);
    --bs-btn-border-color: var(--bbs-danger);
    --bs-btn-hover-bg: var(--bbs-danger);
    --bs-btn-hover-border-color: var(--bbs-danger);
    --bs-btn-active-bg: var(--bbs-danger);
    --bs-btn-active-border-color: var(--bbs-danger);
    --bs-btn-disabled-color: var(--bbs-danger);
    --bs-btn-disabled-border-color: var(--bbs-danger);
}

/* Yellow belongs to the accent, not to a button, even as the "warning" variant. */
.btn-warning {
    --bs-btn-color: var(--bbs-warning);
    --bs-btn-bg: var(--bbs-warning-bg);
    --bs-btn-border-color: var(--bbs-warning);
    --bs-btn-hover-color: #fff;
    --bs-btn-hover-bg: var(--bbs-warning);
    --bs-btn-hover-border-color: var(--bbs-warning);
    --bs-btn-active-color: #fff;
    --bs-btn-active-bg: var(--bbs-warning);
    --bs-btn-active-border-color: var(--bbs-warning);
}

/* Fields: a contour that passes the 3:1 asked of control borders, and the scale's body size. */
.form-control, .form-select {
    border-color: var(--bbs-field-line);
    font-size: var(--bs-body-font-size);
}

.form-control-sm, .form-select-sm {
    font-size: .875rem;
}

.form-check-input {
    border-color: var(--bbs-field-line);
}

/* Focus ring uses the brand yellow over a dark halo so it stays visible on both the
   white content area and the dark sidebar. */
.btn:focus, .btn:active:focus, .btn-link.nav-link:focus, .form-control:focus, .form-select:focus, .form-check-input:focus {
    box-shadow: 0 0 0 0.1rem var(--bbs-ink), 0 0 0 0.25rem var(--bbs-yellow);
}

.form-control:focus, .form-select:focus {
    border-color: var(--bbs-ink);
}

.form-check-input:checked {
    background-color: var(--bbs-ink);
    border-color: var(--bbs-ink);
}

/* O espaço em baixo é tão deliberado como o de cima: sem ele, a última linha de uma
   página — quase sempre os botões de confirmação de um formulário — fica colada ao fim
   do scroll, o que torna difícil acertar-lhes num tablet e faz parecer que a página está
   cortada. Fica aqui, no contentor comum, em vez de ser repetido por página. A barra de
   baixo do telemóvel soma-se: o conteúdo nunca fica por trás dela. */
.content {
    padding: var(--bbs-space-4) var(--bbs-space-4) calc(2.5rem + var(--bbs-bottom-nav-h));
}

@media (min-width: 768px) {
    .content {
        padding-left: var(--bbs-space-5);
        padding-right: var(--bbs-space-5);
    }
}

/* Num ecrã táctil o polegar tapa o fim do ecrã, e alguns browsers móveis sobrepõem ainda
   uma barra de endereço que só desaparece ao deslizar. Mais folga nesses casos. */
@media (pointer: coarse) {
    .content {
        padding-bottom: calc(4rem + var(--bbs-bottom-nav-h));
    }
}

/* Comunicações, the one page that changes the frame around it. On a phone an open conversation is
   the whole screen, the mock-up's way, so the bottom bar goes and nothing stands clear of it. From
   992 px the page fits the window and its two columns scroll, so it needs no room below them. */
@media (max-width: 767.98px) {
    html:has(.inbox-page.thread-open) {
        --bbs-bottom-nav-h: 0px;
    }

    html:has(.inbox-page.thread-open) .bottom-bar {
        display: none;
    }
}

@media (min-width: 992px) {
    .content:has(.inbox-page) {
        padding-bottom: var(--bbs-space-3);
    }
}

h1:focus {
    outline: none;
}

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

/* What is wrong with a field: a red contour and the reason right under it, from EditForm's own
   classes and from the hand-written forms alike. js/page-actions.js brings the first into view. */
.invalid {
    outline: 1px solid var(--bbs-danger);
}

.form-control.invalid, .form-select.invalid, .form-check-input.invalid,
.form-control.is-invalid, .form-select.is-invalid {
    border-color: var(--bbs-danger);
    outline: 1px solid var(--bbs-danger);
}

.validation-message, .field-error {
    margin-top: var(--bbs-space-1);
    color: var(--bbs-danger);
    font-size: .875rem;
    font-weight: 500;
}

/* A page that is only a message: not found, no access, something went wrong. */
.message-page {
    max-width: 32rem;
    margin: var(--bbs-space-6) auto;
    text-align: center;
}

.message-page .message-icon {
    display: inline-block;
    margin-bottom: var(--bbs-space-3);
    color: var(--bbs-muted);
    font-size: 2.25rem;
}

.message-page .message-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: var(--bbs-space-2);
    margin-top: var(--bbs-space-4);
}

.message-page .message-ref {
    margin-top: var(--bbs-space-4);
    color: var(--bbs-muted);
    font-size: .8125rem;
    overflow-wrap: anywhere;
}

/*
    Tables that become a pile of cards on a phone. Each row is a card and each cell a line, labelled from
    its data-label; no wider than the screen, so nothing slides and no button is cut off. From 576 px
    this does nothing at all.

    A table set to display: block stops being a table to a screen reader, in every browser. That is why
    the markup of these tables also says role="table", "row", "cell" and so on, which is redundant on the
    computer and is what keeps the semantics here. The header row is clipped, not removed, for the same
    reason: its column headers still have to be found.

      .tc-title    the cell that names the row: no label, and a card title's weight.
      .tc-actions  the row's buttons: no label, and the card's whole width to tap.
*/
@media (max-width: 575.98px) {
    .table-responsive:has(> .table-cards) {
        overflow: visible;
    }

    .table-cards,
    .table-cards > tbody,
    .table-cards > tbody > tr,
    .table-cards > tbody > tr > td,
    .table-cards > tbody > tr > th {
        display: block;
        width: auto;
    }

    .table-cards {
        margin-bottom: var(--bbs-space-3);
    }

    .table-cards > thead {
        position: absolute;
        width: 1px;
        height: 1px;
        overflow: hidden;
        clip-path: inset(50%);
        white-space: nowrap;
    }

    .table-cards > tbody > tr {
        margin-bottom: var(--bbs-space-3);
        padding: var(--bbs-space-3);
        background: #fff;
        border: 1px solid var(--bbs-line);
        border-radius: var(--bbs-radius);
    }

    .table-cards > tbody > tr > td,
    .table-cards > tbody > tr > th {
        position: relative;
        padding: var(--bbs-space-1) 0;
        border: 0;
        background: none;
        text-align: left !important;
        overflow-wrap: anywhere;
    }

    .table-cards > tbody > tr > [data-label] {
        padding-left: 36%;
        min-height: 1.75rem;
    }

    .table-cards > tbody > tr > [data-label]::before {
        content: attr(data-label);
        position: absolute;
        top: var(--bbs-space-1);
        left: 0;
        width: 34%;
        color: var(--bbs-muted);
        font-size: .8125rem;
        font-weight: 500;
    }

    .table-cards > tbody > tr > :empty {
        display: none;
    }

    .table-cards > tbody > tr > .tc-title {
        padding-top: 0;
        padding-bottom: var(--bbs-space-2);
        font-family: var(--bbs-font-head);
        font-size: 1rem;
        font-weight: 600;
    }

    .table-cards > tbody > tr > .tc-actions {
        padding-top: var(--bbs-space-2);
    }

    .table-cards .tc-actions .btn {
        flex: 1 1 8rem;
        width: 100%;
        min-height: 44px;
    }

    .table-cards .tc-actions .d-flex {
        flex-wrap: wrap;
    }

    .table-cards .tc-actions .form-control {
        flex: 1 1 100%;
        max-width: none !important;
    }
}

/*
    .table-cards.is-compact: the same cards, two cells to a line with each label over its value, for
    tables of short figures (plafonds, feriados, a closed month's lines) where one cell per line made
    every card as tall as the screen. The title and the actions keep the whole width, as does any
    cell marked .tc-wide.
*/
@media (max-width: 575.98px) {
    .table-cards.is-compact > tbody > tr {
        display: grid;
        grid-template-columns: 1fr 1fr;
        column-gap: var(--bbs-space-3);
    }

    .table-cards.is-compact > tbody > tr > [data-label] {
        padding-left: 0;
    }

    .table-cards.is-compact > tbody > tr > [data-label]::before {
        position: static;
        display: block;
        width: auto;
    }

    .table-cards.is-compact > tbody > tr > .tc-title,
    .table-cards.is-compact > tbody > tr > .tc-actions,
    .table-cards.is-compact > tbody > tr > .tc-wide,
    .table-cards.is-compact > tbody > tr > [colspan] {
        grid-column: 1 / -1;
    }
}

.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: "Ocorreu um erro."
    }

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

/* A floating label sits where the placeholder is until the field is focused, so the placeholder is
   kept out of sight until then, as Bootstrap has it. The template showed it pushed to the right
   instead, and on a phone a long label ("Número de telefone") ran into it. Focused, the label has
   moved to the top and the example shows under it. */
.form-floating > .form-control-plaintext::placeholder, .form-floating > .form-control::placeholder {
    color: transparent;
}

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

/* ============================================================================
   TOUCH-DEVICE FIXES  (from the iPad review)
   ----------------------------------------------------------------------------
   An iPad review of the management UI surfaced two systemic touch problems.
   Both are fixed GLOBALLY here, but ONLY on touch devices via
   `@media (pointer: coarse)` — that query matches touch screens (tablets /
   phones) and never a mouse-driven desktop, so the desktop layout is left
   exactly as designed.

   1. ANTI-ZOOM. iOS Safari auto-zooms the viewport whenever the user focuses an
      <input>/<select>/<textarea> whose font-size is BELOW 16px. Bootstrap's
      `.form-control-sm` / `.form-select-sm` are 14px and are used pervasively
      across the management forms, tables and filters (holiday entitlements,
      channel config, category editor, approval comment box, filter selects), so
      every focus jarringly zoomed the page. Lifting them to the 16px floor iOS
      needs stops the zoom; 16px is only ~2px larger than 14px so the controls
      stay visually reasonable. They also take the 44px minimum of point 2.

   2. TAP TARGETS. Several controls fall below Apple's HIG 44x44 CSS-px minimum:
      `.btn-sm` (~31px), `.btn-close` (~24px) and the small `.form-check-input`
      checkboxes. They are enlarged to be comfortably tappable. Labels are
      already tappable, so the checkbox bump is kept gentle.
   ============================================================================ */
@media (pointer: coarse) {

    /* --- 1. Anti-zoom: hold interactive text controls at the 16px iOS floor --- */
    .form-control,
    .form-select,
    .form-control-sm,
    .form-select-sm {
        font-size: 16px;
        min-height: 44px;
    }

    /* Belt-and-braces catch for raw controls that carry no Bootstrap sizing
       class. Deliberately kept as bare element selectors (specificity 0,0,1) so
       they sit BELOW any class-based font-size — Bootstrap's `.form-control`,
       `.form-control-sm` (set to 16px just above) and even a deliberately larger
       `.form-control-lg` all still win. This makes 16px behave as a floor for
       unclassed inputs only and never drags a larger control down. */
    input,
    select,
    textarea {
        font-size: 16px;
    }

    /* --- 2. Tap targets: Apple HIG 44x44 CSS-px minimum --- */
    /* `.btn-sm` gains height; inline-flex re-centres the label so the now-taller
       button centres its text vertically instead of top-aligning it. */
    .btn,
    .btn-sm,
    .btn-group-sm > .btn {
        min-height: 44px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }

    /* The close (x) button is icon-only and only ~24px — give it a full target. */
    .btn-close {
        min-width: 44px;
        min-height: 44px;
    }

    /* Modest bump only — the label is already a tap target, so we keep it gentle. */
    .form-check-input {
        width: 1.15rem;
        height: 1.15rem;
    }
}

/* Reconnecting: a tap now would go nowhere, so the page ignores it. See ReconnectModal.razor.js. */
html.bbs-reconnecting body {
    pointer-events: none;
}

html.bbs-reconnecting #components-reconnect-modal:modal {
    pointer-events: auto;
}

/* The installed app's lock (js/app-lock.js): nothing of the page shows from before the first paint
   until the circuit puts the lock screen up. Hidden rather than painted over, so nothing behind it
   can be reached either. The lock screen and the reconnection notice stay visible. */
html.bbs-lock-cover {
    background-color: var(--bbs-bg);
}

html.bbs-lock-cover body {
    visibility: hidden;
}

html.bbs-lock-cover #components-reconnect-modal {
    visibility: visible;
}
