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

/* Bootstrap 5's reboot does not cap image width (img-fluid is opt-in), so a photo with
   no sizing rule of its own renders at its natural resolution and blows out the page.
   Belt and braces, so a stylesheet problem can never do that again. */
img {
    max-width: 100%;
}

/* ===========================================================================
   Design tokens.

   Modelled on the owner's previous Glide app, which the people actually doing
   inventories already know: green accent, white cards on a soft grey ground,
   generous rounding, airy list rows. Everything below refers to these, so the
   palette can be changed in one place.
   =========================================================================== */

:root {
    --pm-green: #6f9c41;
    --pm-green-dark: #5a8034;
    --pm-green-soft: #eef4e6;
    --pm-progress: #34a853;

    --pm-bg: #f4f5f6;
    --pm-surface: #ffffff;
    --pm-border: #e5e7eb;

    --pm-text: #1f2328;
    --pm-muted: #6b7280;

    --pm-radius: 12px;

    /* The top bar and the side panel (NavMenu). */
    --pm-bar-h: 3.5rem;
    --pm-side-w: 240px;
    --pm-side-rail-w: 64px;
    --pm-radius-sm: 8px;
    --pm-shadow: 0 1px 2px rgba(16, 24, 40, 0.06), 0 1px 3px rgba(16, 24, 40, 0.10);
}

body {
    background: var(--pm-bg);
    color: var(--pm-text);
}

/* Bootstrap's blue is the single most "default template" thing about the app, so the
   primary button is restyled rather than a new class being introduced - that way every
   existing button inherits the new look without touching markup. */
.btn-primary {
    background-color: var(--pm-green);
    border-color: var(--pm-green);
}

.btn-primary:hover,
.btn-primary:focus,
.btn-primary:active,
.btn-primary:disabled {
    background-color: var(--pm-green-dark);
    border-color: var(--pm-green-dark);
}

.btn-success {
    background-color: var(--pm-green);
    border-color: var(--pm-green);
}

.btn-success:hover,
.btn-success:focus,
.btn-success:active {
    background-color: var(--pm-green-dark);
    border-color: var(--pm-green-dark);
}

.btn-outline-primary {
    color: var(--pm-green-dark);
    border-color: var(--pm-green);
}

.btn-outline-primary:hover,
.btn-outline-primary:active {
    background-color: var(--pm-green);
    border-color: var(--pm-green);
}

a, .btn-link {
    color: var(--pm-green-dark);
}

.btn, .form-control, .form-select {
    border-radius: var(--pm-radius-sm);
}

/* Comfortable to hit with a thumb, and tall enough that a phone doesn't zoom on focus. */
.form-control, .form-select {
    min-height: 2.75rem;
    font-size: 1rem;
}

.card {
    border: 1px solid var(--pm-border);
    border-radius: var(--pm-radius);
    box-shadow: var(--pm-shadow);
}

.progress-bar {
    background-color: var(--pm-progress);
}

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

.breadcrumb {
    font-size: 0.875rem;
    margin-bottom: 0.75rem;
}

/* A plain row in a list: bold name, muted detail beneath, nothing boxed in. Replaces
   the dense tables, which are unreadable on a phone. */
.pm-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.875rem 1rem;
    background: var(--pm-surface);
    border-bottom: 1px solid var(--pm-border);
}

.pm-row:first-child {
    border-top-left-radius: var(--pm-radius);
    border-top-right-radius: var(--pm-radius);
}

.pm-row:last-child {
    border-bottom: 0;
    border-bottom-left-radius: var(--pm-radius);
    border-bottom-right-radius: var(--pm-radius);
}

.pm-row-title {
    font-weight: 500;
}

.pm-row-sub {
    font-size: 0.8125rem;
    color: var(--pm-muted);
}

/* Wraps a run of .pm-row into one card. */
.pm-list {
    background: var(--pm-surface);
    border: 1px solid var(--pm-border);
    border-radius: var(--pm-radius);
    box-shadow: var(--pm-shadow);
    overflow: hidden;
}

/* The Blazor template's blue link/button rules used to live here. They sat *after* the
   token block above and so kept overriding it - removed rather than reordered, since the
   tokens now define both. */

.btn:focus, .btn:active:focus, .btn-link.nav-link:focus, .form-control:focus, .form-check-input:focus {
    box-shadow: 0 0 0 0.1rem #fff, 0 0 0 0.25rem rgba(111, 156, 65, 0.4);
}

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,PHN2ZyB3aWR0aD0iNTYiIGhlaWdodD0iNDkiIHhtbG5zPSJodH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AxNjEgMjY1LjM4IDg0LjAxNjEgMjY3LjgyMSA2OS43NDc1QzI2Ny44NiA2OS43MzA5IDI2Ny44NzkgNjkuNTg3NyAyNjcuODc5IDY5LjMxNzkgMjY3Ljg3OSA2Ny4xMTgyIDI2Ni40NDggNjYuMDE4MyAyNjMuNTg2IDY2LjAxODNaTTI2My41NzYgODYuMDU0N0MyNjEuMDQ5IDg2LjA1NDcgMjU5Ljc4NiA4Ny4zMDA1IDI1OS43ODYgODkuNzkyMSAyNTkuNzg2IDkyLjI4MzcgMjYxLjA0OSA5My41Mjk1IDI2My41NzYgOTMuNTI5NSAyNjYuMTE2IDkzLjUyOTUgMjY3LjM4NyA5Mi4yODM3IDI2Ny4zODcgODkuNzkyMSAyNjcuMzg3IDg3LjMwMDUgMjY2LjExNiA4Ni4wNTQ3IDI2My41NzYgODYuMDU0N1oiIGZpbGw9IiNGRkU1MDAiIGZpbGwtcnVsZT0iZXZlbm9kZCIvPjwvZz48L3N2Zz4=) no-repeat 1rem/1.8rem, #b32121;
    padding: 1rem 1rem 1rem 3.7rem;
    color: white;
}

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

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

/* ---------------------------------------------------------------------------
   Inventory ("état des lieux") capture flow.

   This is the one part of the app used on a phone, one-handed, while walking
   around a flat - so tap targets are sized for a thumb and nothing important
   sits behind a horizontal scroll.
   --------------------------------------------------------------------------- */

/* Room grid on the inventory page: photo-tile per room, two-up on a phone. */
.room-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
}

@media (min-width: 768px) {
    .room-grid {
        grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    }
}

.room-tile {
    display: block;
    width: 100%;
    padding: 0;
    border: 1px solid #dee2e6;
    border-radius: 0.5rem;
    background: #fff;
    overflow: hidden;
    text-align: left;
    color: inherit;
}

.room-tile:active {
    background: #f1f3f5;
}

.room-tile-done {
    border-color: #75b798;
    box-shadow: inset 0 0 0 1px #75b798;
}

/* Shown when a room has no photo yet. */
.room-tile-thumb {
    aspect-ratio: 4 / 3;
    background: #e9ecef;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    color: #adb5bd;
}

.room-tile-label {
    padding: 0.5rem 0.625rem;
    font-weight: 500;
    line-height: 1.25;
}

.room-tile-meta {
    display: block;
    font-weight: 400;
    font-size: 0.8125rem;
    color: #6c757d;
}

/* One graded line. A card rather than a table row, so it reflows on a phone. */
.grade-row {
    padding: 0.625rem 0;
    border-bottom: 1px solid #e9ecef;
}

.grade-row:last-child {
    border-bottom: 0;
}

.grade-row-name {
    font-weight: 500;
}

.grade-row-extra {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.grade-row-extra .form-control {
    min-height: 2.5rem;
}

.grade-qty {
    max-width: 6rem;
}

.grade-unit {
    max-width: 7rem;
}

.grade-note {
    flex: 1 1 12rem;
    min-width: 0;
}

/* Star picker. Buttons, not a <select> - a native picker per row is unusable
   when there are forty rows in a kitchen. */
.star-rating {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.125rem;
}

.star-rating .star {
    border: 0;
    background: none;
    padding: 0.25rem 0.125rem;
    font-size: 1.75rem;
    line-height: 1;
    min-width: 2.25rem;
    min-height: 2.25rem;
    cursor: pointer;
    color: #ced4da;
}

.star-rating .star-on {
    color: #f0a500;
}

.star-rating .star:disabled {
    cursor: default;
    opacity: 0.5;
}

/* Still a real thumb target in the compact list variant: five of these plus the
   caption on its own line fits inside a 375px screen, so there is no reason to
   shrink below roughly 40px. */
.star-rating-compact .star {
    font-size: 1.5rem;
    min-width: 2.5rem;
    min-height: 2.5rem;
}

.star-caption {
    font-size: 0.8125rem;
    color: #6c757d;
    margin-left: 0.375rem;
}

.star-rating-compact .star-caption {
    flex-basis: 100%;
    margin-left: 0;
}

/* Save/completion bar pinned to the bottom of the room screen, so "done" is
   always reachable without scrolling back past forty items. */
.sticky-actions {
    position: sticky;
    bottom: 0;
    background: #fff;
    border-top: 1px solid #dee2e6;
    padding: 0.75rem 0;
    margin-top: 1rem;
    z-index: 10;
}

.save-state {
    font-size: 0.8125rem;
    color: #6c757d;
}

.save-state-saved {
    color: #198754;
}

.save-state-error {
    color: #dc3545;
}

/* Photos ------------------------------------------------------------------- */

.photo-field {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    align-items: flex-start;
}

.photo-field-actions {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    flex-wrap: wrap;
}

/* The label wraps a hidden <InputFile>, so it has to look and size like a button. */
.photo-field-actions label.btn {
    cursor: pointer;
    margin-bottom: 0;
}

.photo-thumb {
    display: block;
    max-width: 100%;
    width: 220px;
    aspect-ratio: 4 / 3;
    object-fit: cover;
    border-radius: 0.375rem;
    border: 1px solid #dee2e6;
    background: #e9ecef;
}

.photo-thumb-sm {
    width: 96px;
    border-radius: 0.25rem;
}

/* Banner photo at the top of a property or room card. */
.card-photo {
    width: 100%;
    aspect-ratio: 16 / 9;
    object-fit: cover;
    display: block;
    border-top-left-radius: calc(0.375rem - 1px);
    border-top-right-radius: calc(0.375rem - 1px);
    background: #e9ecef;
}

/* ---- Shared card/detail conventions (see CLAUDE.md "UI conventions") ---- */

/* Holds a record's picture and its edit/delete icon buttons in the top-right corner. */
.card-photo-wrap {
    position: relative;
}

.card-photo-empty {
    display: flex;
    align-items: center;
    justify-content: center;
    color: #adb5bd;
    font-size: 2.5rem;
}

/* Above a card's .stretched-link (z-index 1), so tapping a button doesn't open the card. */
.card-photo-actions {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    z-index: 2;
    display: flex;
    gap: 0.375rem;
}

.icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.5rem;
    height: 2.5rem;
    border: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.92);
    color: var(--pm-text, #212529);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
}

.icon-btn:hover,
.icon-btn:focus-visible {
    background: #fff;
    color: var(--bs-primary);
}

.icon-btn-danger:hover,
.icon-btn-danger:focus-visible {
    color: var(--bs-danger);
}

/* Icon buttons on a plain background (a table row) rather than over a photo. */
.icon-btn-flat {
    background: transparent;
    box-shadow: none;
    width: 2.25rem;
    height: 2.25rem;
}

/* The whole card opens its record. */
.card-link {
    transition: box-shadow 0.15s ease;
}

.card-link:hover {
    box-shadow: 0 0.25rem 0.75rem rgba(0, 0, 0, 0.12);
}

.card-link .card-title a {
    color: inherit;
    text-decoration: none;
}

.clickable-row {
    cursor: pointer;
}

.back-link {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    min-height: 2.5rem;
    margin-bottom: 0.5rem;
    text-decoration: none;
    font-weight: 500;
}

/* Document template editor */
.template-body {
    font-size: 0.8125rem;
}

.template-preview {
    max-height: 42rem;
    overflow-y: auto;
}

/* A generated part in the preview: stands in for the tables the PDF will print. */
.template-block {
    border: 1px dashed #adb5bd;
    border-radius: 0.25rem;
    background: #f8f9fa;
    color: var(--pm-muted, #6c757d);
    font-family: var(--bs-font-monospace);
    font-size: 0.8125rem;
    padding: 0.375rem 0.5rem;
    margin: 0.5rem 0;
}

.tenancy-summary {
    font-size: 0.9375rem;
    display: grid;
    gap: 0.25rem;
}

/* Fills the tile's thumbnail slot, replacing the placeholder icon. */
.room-tile-photo {
    width: 100%;
    aspect-ratio: 4 / 3;
    object-fit: cover;
    display: block;
}

/* Tablet and up ------------------------------------------------------------
   An inventory is just as likely to be done on a tablet as a phone, where
   there's room to put the name and its grade on one line instead of stacking
   everything. Below this the single-column stack from above still applies. */
@media (min-width: 768px) {
    .grade-row {
        display: grid;
        grid-template-columns: minmax(8rem, 1fr) auto;
        align-items: center;
        column-gap: 1rem;
        row-gap: 0.375rem;
    }

    .grade-row-extra {
        grid-column: 1 / -1;
        margin-top: 0;
    }

    .star-rating-compact .star-caption {
        flex-basis: auto;
        margin-left: 0.375rem;
    }
}

/* An item recorded as no longer being there. Dimmed rather than hidden - it still has
   to appear on the finished document. */
.grade-row-absent .grade-row-name {
    text-decoration: line-through;
    color: #6c757d;
}

.grade-row-absent {
    background: #fffbf0;
}

/* Item groups ------------------------------------------------------------- */

.group-swatch {
    display: inline-block;
    width: 1.125rem;
    height: 1.125rem;
    border-radius: 50%;
    border: 1px solid rgba(0, 0, 0, 0.15);
    vertical-align: middle;
}

.group-swatch-button {
    cursor: pointer;
    padding: 0;
    /* Big enough to hit on a phone even though the dot itself is small. */
    width: 1.75rem;
    height: 1.75rem;
}

.group-swatch-on {
    box-shadow: 0 0 0 2px #fff, 0 0 0 4px #495057;
}

/* Filter chips above a long item list. */
.group-filter {
    display: flex;
    flex-wrap: wrap;
    gap: 0.375rem;
    margin-bottom: 0.75rem;
}

.group-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    border: 1px solid #dee2e6;
    border-radius: 999px;
    background: #fff;
    padding: 0.3125rem 0.75rem;
    font-size: 0.875rem;
    min-height: 2.25rem;
    cursor: pointer;
}

.group-chip-on {
    border-color: #495057;
    background: #f1f3f5;
    font-weight: 500;
}

/* Collapsible section header above a grouped block of rows (by kind or by custom
   group) - a full-width button so the whole heading, not just the chevron, toggles it. */
.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    border: 0;
    background: none;
    padding: 0;
    text-align: left;
    cursor: pointer;
    color: inherit;
}

.section-header i {
    color: var(--pm-muted);
    min-width: 2.5rem;
    min-height: 2.5rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* What moved since the last inventory, shown next to the row's name. */
.change-note {
    font-size: 0.8125rem;
    font-weight: 400;
    color: #b45309;
    margin-left: 0.375rem;
}

/* Compact grade row: name and stars on one line, everything else behind the chevron. */
.grade-row-head {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.grade-row-head .grade-row-name {
    flex: 1 1 8rem;
    min-width: 0;
}

.grade-row-toggle {
    border: 0;
    background: none;
    color: var(--pm-muted);
    min-width: 2.5rem;
    min-height: 2.5rem;
    cursor: pointer;
    margin-left: auto;
}

/* In the compact row the caption would push the stars onto their own line. */
.grade-row-head .star-rating-compact .star-caption {
    flex-basis: auto;
}

/* The condition caption changes width as the grade changes ("Bon état" vs "État
   passable"), and because the row is a flex line that re-flowed the stars out from
   under the finger mid-tap. Reserving the width keeps them still. */
.grade-row-head .star-caption {
    display: inline-block;
    min-width: 7.5rem;
}

.grade-row-qty {
    display: block;
    font-size: 0.8125rem;
    font-weight: 400;
    color: var(--pm-muted, #6c757d);
}

@media (max-width: 767px) {
    /* One line per row on a phone - name | stars | chevron - since this is the list
       you scroll most. The grade caption is dropped here: the filled stars (and
       their tooltips) already say it, and at ~100px it was what forced the wrap.
       With no caption there is nothing left to shift the stars mid-tap either. */
    .grade-row {
        padding: 0.375rem 0;
    }

    .grade-row-head {
        flex-wrap: nowrap;
        gap: 0.25rem;
    }

    .grade-row-head .grade-row-name {
        flex: 1 1 auto;
        line-height: 1.25;
        overflow-wrap: anywhere;
    }

    .grade-row-head .star-caption {
        display: none;
    }

    .grade-row-head .star-rating {
        flex-wrap: nowrap;
        gap: 0;
    }

    .star-rating-compact .star {
        min-width: 2.25rem;
        min-height: 2.5rem;
        padding: 0;
        font-size: 1.375rem;
    }

    .grade-row-toggle {
        min-width: 2.25rem;
    }
}

/* ---- Signature pad ------------------------------------------------------- */
/* Drawn with a finger, standing in a flat, so the box is generous. touch-action
   is what stops the page scrolling under the stroke on a phone; without it a
   signature turns into a scroll gesture half the time. */
.pm-signature-pad {
    display: block;
    width: 100%;
    height: 160px;
    border: 1px dashed #adb5bd;
    border-radius: 6px;
    background: #fff;
    touch-action: none;
    cursor: crosshair;
}

/* A saved signature as shown on the profile: on white, like the paper it lands on. */
.pm-saved-signature {
    display: block;
    max-width: 100%;
    height: 100px;
    object-fit: contain;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    background: #fff;
    padding: 4px;
}

/* No page scroll behind the side panel while it covers a phone screen. */
body.pm-side-locked {
    overflow: hidden;
}

@media (min-width: 992px) {
    body.pm-side-locked {
        overflow: auto;
    }
}

/* Bootstrap's text-bg-* helpers arrived in 5.2; the local stylesheet is 5.1, so without
   these every badge using them (rent state, "Signed", "Active") rendered white on nothing. */
.text-bg-primary { color: #fff !important; background-color: var(--bs-primary) !important; }
.text-bg-secondary { color: #fff !important; background-color: var(--bs-secondary) !important; }
.text-bg-success { color: #fff !important; background-color: var(--bs-success) !important; }
.text-bg-danger { color: #fff !important; background-color: var(--bs-danger) !important; }
.text-bg-warning { color: #000 !important; background-color: var(--bs-warning) !important; }
.text-bg-info { color: #000 !important; background-color: var(--bs-info) !important; }
.text-bg-light { color: #000 !important; background-color: var(--bs-light) !important; }
.text-bg-dark { color: #fff !important; background-color: var(--bs-dark) !important; }
