html, body {
   height: 100%;
}
.page-wrapper {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}
.page-content {
    flex: 1;
    padding-bottom: env(safe-area-inset-bottom);
}
.table-scroll {
    max-height: 90vh;
    max-width: 100%;
    overflow: auto;
}
.table-scroll thead th {
    position: sticky;
    top: 0;
    background: white;
    z-index: 2;
}
[data-bs-theme="dark"] .table-scroll thead th {
    background: var(--bs-body-bg);
}
.dropdown-scroll {
    max-height: 320px;
    overflow-y: auto;
    width: 100%;
}
.navbar #organisationDropdown {
    color: var(--bs-navbar-color);
}
.navbar #organisationDropdown:hover,
.navbar #organisationDropdown:focus {
    color: var(--bs-navbar-hover-color);
}
.navbar-brand {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}
/* Physio's logo: its P, the name next to it. */
.physio-navbar-logo {
    width: 2.25rem;
    height: 2.25rem;
}
/* An organisation's own logo in the nav bar (Organisation.logo): its height, whatever its shape. */
.organisation-navbar-logo {
    height: 2.25rem;
    max-width: 12rem;
    object-fit: contain;
}
.login-screen {
    background: #f7f8fa;
}
.login-screen .navbar {
    display: none;
}
.login-screen .page-content > .container {
    max-width: none;
    height: 100%;
    margin: 0 !important;
    padding: 0;
}
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

@media (max-width: 1199px) {
    .container {
        max-width: 95%;
        padding-left: 0.3rem;
        padding-right: 0.3rem;
    }
}

@media (min-width: 1200px) {
    .container {
        padding-left: 0.5rem;
        padding-right: 0.5rem;
    }
}

/* Lookup component (see components/lookup.html): a search input paired with
   an "open related record" button, and an inline clear cross shown inside
   the input itself once it holds a value. */
.lookup-field {
    position: relative;
    flex: 1 1 auto;
    width: 1%;
    min-width: 0;
}
.lookup-field .form-control {
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
    padding-right: 1.75rem;
}
.lookup-field + .btn {
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
    margin-left: -1px;
}
.lookup-clear {
    position: absolute;
    top: 50%;
    right: .5rem;
    transform: translateY(-50%);
    background: none;
    border: none;
    padding: 0;
    line-height: 1;
    color: var(--bs-danger);
    z-index: 5;
}

/* color_picker component (components/color_picker.html) and the colour swatches shown
   next to a project wherever it's listed. */
.color-swatch {
    display: inline-block;
    width: 1rem;
    height: 1rem;
    border-radius: 3px;
    vertical-align: -0.15em;
    border: 1px solid rgba(0, 0, 0, .15);
}
.color-swatch-none {
    background: repeating-linear-gradient(45deg, transparent 0 3px, rgba(127, 127, 127, .35) 3px 5px);
}
/* The picker's button looks like the form's other fields (form-control), not like an
   outline button: same border, background, text and focus ring — and same height (a
   .form-control's min-height), whatever it holds. */
.color-picker-toggle {
    display: inline-flex;
    align-items: center;
    gap: .5rem;
    height: calc(1.5em + .75rem + calc(var(--bs-border-width) * 2));
}
.color-picker-toggle,
.color-picker-toggle:hover,
.color-picker-toggle:active,
.color-picker-toggle.show {
    border-color: var(--bs-border-color);
    background-color: var(--bs-body-bg);
    color: var(--bs-body-color);
}
.color-picker-toggle:focus-visible,
.color-picker-toggle:focus {
    border-color: #86b7fe;
    box-shadow: 0 0 0 .25rem rgba(13, 110, 253, .25);
    background-color: var(--bs-body-bg);
    color: var(--bs-body-color);
}
.color-picker-menu {
    min-width: 0;
}
.color-picker-grid {
    display: grid;
    grid-template-columns: repeat(24, 18px);
    gap: 3px;
}
@media (max-width: 575.98px) {
    .color-picker-grid {
        grid-template-columns: repeat(12, 18px);
    }
}
.color-picker-swatch {
    width: 18px;
    height: 18px;
    padding: 0;
    border: 1px solid rgba(0, 0, 0, .15);
    border-radius: 3px;
}
.color-picker-swatch:hover {
    transform: scale(1.25);
}
.color-picker-swatch.active {
    outline: 2px solid var(--bs-body-color);
    outline-offset: 1px;
}

/* Gradients of the dashboard cards (member_widgets, ticket statuses...) — every
   member_widgets card shares the muted gray one — and of the progress bars' colored
   zones (see .bar-hatched), per Bootstrap contextual color. */
.gradient-gray { --gradient: linear-gradient(135deg, #8e97a0, #c9d0d6); }
.gradient-secondary { --gradient: linear-gradient(135deg, #737b83, #a9b4bd); }
.gradient-primary { --gradient: linear-gradient(135deg, #5b86e5, #764ba2); }
.gradient-info { --gradient: linear-gradient(135deg, #5b86e5, #36d1dc); }
.gradient-warning { --gradient: linear-gradient(135deg, #f7971e, #ffd200); }
.gradient-success { --gradient: linear-gradient(135deg, #11998e, #38ef7d); }
.gradient-danger { --gradient: linear-gradient(135deg, #ff5e62, #ff9966); }
.gradient-gray, .gradient-secondary, .gradient-primary, .gradient-info, .gradient-warning,
.gradient-success, .gradient-danger {
    background: var(--gradient);
}

/* A progress bar's colored zone: its gradient, hatched. */
.progress .bar-hatched,
.progress.bar-hatched {
    background-color: transparent;
    background-image: linear-gradient(45deg, rgba(255, 255, 255, .2) 25%, transparent 25%, transparent 50%,
                                      rgba(255, 255, 255, .2) 50%, rgba(255, 255, 255, .2) 75%, transparent 75%,
                                      transparent), var(--gradient);
    background-size: 1rem 1rem, 100% 100%;
}

/* The small color square of a legend (e.g. the tickets bar's popover). */
.legend-square {
    display: inline-block;
    width: .75rem;
    height: .75rem;
    border-radius: 2px;
    margin-right: .4rem;
    vertical-align: -0.05em;
}


/* The Météo section's weather menu (components/weather_cards.html), after fontaine's
   weather component. */
.weather-dropdown {
    border: none;
    border-radius: 16px;
    padding: 10px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, .14);
}
.weather-dropdown .weather-option {
    display: flex;
    align-items: center;
    gap: 12px;
    border-radius: 12px;
    padding: 10px 14px;
}
.weather-dropdown .weather-option .weather-icon {
    width: 26px;
    height: 26px;
    flex-shrink: 0;
}

/* The dashboard's Météo section (components/weather_cards.html). */
/* As tall as the other home cards' number (.stat-total: 2.6rem at a 1.5 line height),
   so every card on the page has the same height. */
.weather-card .weather-card-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 3.9rem;
    font-size: 3.9rem;
    line-height: 1;
}
.weather-card .weather-card-toggle {
    border: none;
    background: transparent;
    padding: 0;
    transition: transform .15s ease;
}
.weather-card .weather-card-toggle:hover {
    transform: scale(1.08);
}
/* The own card's small brush icon (an icon-only color_picker), top right. */
.weather-card .weather-card-color {
    position: absolute;
    top: 8px;
    right: 10px;
    z-index: 2;
}
/* Under the weather: the member's record in progress. */
.weather-card .weather-card-record {
    margin-top: 4px;
    opacity: .85;
}
.color-picker-icon {
    color: inherit;
    opacity: .8;
    line-height: 1;
}
.color-picker-icon:hover {
    color: inherit;
    opacity: 1;
}
/* A dashboard card (Météo, member widgets) without a colour of its own: close to white
   (dark gray in the dark theme). */
.stat-card.stat-card-default {
    background: linear-gradient(135deg, #ffffff, #eef1f4);
    color: #212529;
    border: 1px solid rgba(0, 0, 0, .06);
}
[data-bs-theme="dark"] .stat-card.stat-card-default {
    background: linear-gradient(135deg, #3a4047, #2b3035);
    color: #f8f9fa;
    border-color: rgba(255, 255, 255, .08);
}

/* Pages (page_view, section_tree*): clickable cards, the dashed "Ajouter" frames,
   paragraphs in Markdown, their drag & drop, and the reading mode hiding the editing. */
.hoverable-card {
    cursor: pointer;
    transition: background-color 0.1s ease;
}

.hoverable-card:hover {
    background-color: var(--bs-tertiary-bg);
}

.dashed-add-frame {
    border: 1px dashed #adb5bd;
    color: #6c757d;
    cursor: pointer;
    transition: border-color 0.1s ease, color 0.1s ease;
}

.dashed-add-frame:hover {
    border-color: var(--bs-success);
    color: var(--bs-success);
}

.markdown-content p {
    margin: 0;
}

.markdown-content ul, .markdown-content ol {
    margin: 0;
    padding-left: 1.2em;
}

.paragraph-drop-zone [draggable="true"] {
    cursor: grab;
}

.paragraph-drop-zone [draggable="true"].dragging {
    opacity: 0.5;
}

.paragraph-drop-zone { min-height: 1.5rem; }

/* The section a dragged paragraph would be dropped in. */
.paragraph-section.paragraph-drop-target {
    outline: 2px dashed var(--bs-primary);
    outline-offset: 4px;
    border-radius: .375rem;
}

.reading-mode .reading-hide { display: none !important; }
.reading-mode .hoverable-card { cursor: default; }

/* components/image_input.html: an image, clicked to pick another, removed by its red cross. */
.image-input { position: relative; display: inline-block; }
.image-input-preview { display: block; cursor: pointer; margin: 0; }
.image-input-preview img { display: block; max-height: 120px; border-radius: .375rem; }
.image-input-empty { display: flex; align-items: center; justify-content: center; width: 120px; height: 120px;
    border: 2px dashed var(--bs-border-color); border-radius: .375rem; color: var(--bs-secondary-color); font-size: 2rem; }
.image-input-preview:hover .image-input-empty { border-color: var(--bs-primary); color: var(--bs-primary); }
.image-input-remove { position: absolute; top: -10px; right: -10px; width: 26px; height: 26px; padding: 0;
    display: flex; align-items: center; justify-content: center; border-radius: 50%; border: 2px solid #fff;
    background: #dc3545; color: #fff; font-size: 12px; line-height: 1; box-shadow: 0 1px 3px rgba(0, 0, 0, .3); }
.image-input-remove:hover { background: #bb2d3b; }
.image-input-remove[hidden], .image-input-empty[hidden] { display: none; }

/* Date and time fields without the browser's picker icon (the picker opens on a click). */
input.no-picker-icon::-webkit-calendar-picker-indicator { display: none; }

/* The guests' lists: an expired storage or reminder in red, a validated event in green —
   the row's colour, which a striped table's cells would otherwise override. */
.table > tbody > tr.text-danger > td { color: var(--bs-danger); }
.table > tbody > tr.text-success > td { color: var(--bs-success); }

/* A sortable table's column headers (see sortable_table.js): the sorted one's arrow. */
th.sortable.sorted-asc::after { content: " \25B2"; font-size: .7em; }
th.sortable.sorted-desc::after { content: " \25BC"; font-size: .7em; }
/* A movable column's header (see movable_columns.js): dragged, and where it would be dropped. */
th.movable.dragging { opacity: .5; }
th.movable.drop-before { box-shadow: inset 3px 0 0 var(--bs-primary); }
th.movable.drop-after { box-shadow: inset -3px 0 0 var(--bs-primary); }

/* The exercises' photos: a thumbnail in the lists, a tile on the exercise's page (with its
   red cross to remove it), as shown on the patient's programme. */
.photo-thumb-sm {
    width: 56px;
    height: 56px;
    object-fit: contain;
    border-radius: 6px;
    background: #fff;
}
.photo-tile {
    position: relative;
}
.photo-tile img, .photo-tile video {
    height: 140px;
    max-width: 220px;
    object-fit: contain;
    border-radius: 8px;
    border: 1px solid var(--bs-border-color);
    background: #fff;
}
.photo-tile-remove {
    position: absolute;
    top: -8px;
    right: -8px;
    border: none;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    padding: 0;
    color: #fff;
    background: var(--bs-danger);
    font-size: 0.75rem;
}
.program-photo {
    max-height: 200px;
    max-width: 100%;
    object-fit: contain;
    border-radius: 8px;
    margin: 0.5rem 0;
}
.program-steps li {
    margin-bottom: 0.5rem;
}
/* The home page's cards (as Citadelle's member widgets): a gradient each, its icon as a
   watermark, its number below its title — the whole card a link. */
.gradient-primary { --gradient: linear-gradient(135deg, #5b86e5, #764ba2); }
.gradient-info { --gradient: linear-gradient(135deg, #5b86e5, #36d1dc); }
.gradient-warning { --gradient: linear-gradient(135deg, #f7971e, #ffd200); }
.gradient-success { --gradient: linear-gradient(135deg, #11998e, #38ef7d); }
.gradient-danger { --gradient: linear-gradient(135deg, #ff5e62, #ff9966); }
.gradient-primary, .gradient-info, .gradient-warning, .gradient-success, .gradient-danger {
    background: var(--gradient);
}
.stat-card {
    position: relative;
    display: block;
    color: white;
    border-radius: 14px;
    padding: 15px;
    overflow: hidden;
    height: 100%;
    text-decoration: none;
}
.stat-card:hover {
    color: white;
}
.stat-title {
    text-align: center;
    font-weight: 600;
    font-size: 1.2rem;
    margin-bottom: 10px;
}
.stat-total {
    font-size: 2.6rem;
    font-weight: bold;
    text-align: center;
}
.stat-card .watermark {
    position: absolute;
    top: 10px;
    left: 10px;
    font-size: 5rem;
    opacity: 0.12;
    pointer-events: none;
}
.stat-card-clickable {
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.stat-card-clickable:hover {
    transform: translateY(2px);
    box-shadow: 0 .25rem .5rem rgba(0, 0, 0, .15) !important;
}
@media print {
    .program-exercise {
        break-inside: avoid;
    }
}

/* A score (components/score_star.html): a gold star, the score in its middle. */
.score-star {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.4rem;
    height: 2.4rem;
    vertical-align: middle;
    flex-shrink: 0;
}
.score-star svg {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    fill: #f5b301;
    filter: drop-shadow(0 1px 1px rgba(0, 0, 0, .25));
}
.score-star-value {
    position: relative;
    top: 0.08em;
    font-size: 0.8rem;
    font-weight: 700;
    color: #3d2c00;
    line-height: 1;
}
.score-star-lg {
    width: 4rem;
    height: 4rem;
}
.score-star-lg .score-star-value {
    font-size: 1.3rem;
}
/* A best score: purple; a score not shared (see Patient.share_score): gray, a padlock instead. */
.score-star-best svg {
    fill: #8e5bd8;
}
.score-star-best .score-star-value {
    color: #fff;
}
.score-star-hidden svg {
    fill: #c4c9ce;
}
.score-star-hidden .score-star-value {
    color: #5c636a;
}
