/* Login / setup pages */
.auth-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.auth-card {
    width: 100%;
    max-width: 380px;
}

.auth-card-wide {
    max-width: 440px;
}

/* MFA */
.mfa-qr {
    display: inline-block;
    padding: 12px;
    background: #fff; /* QR codes need a light background to scan reliably */
    border-radius: 8px;
    line-height: 0;
}

.mfa-code-input {
    font-family: var(--bs-font-monospace);
    letter-spacing: 0.2em;
}

/* Registration bot trap: off-screen rather than display:none, which some bots skip */
.auth-hp {
    position: absolute;
    left: -10000px;
    width: 1px;
    height: 1px;
    overflow: hidden;
}

/* Desktop-only gate: below 1000px the app is hidden and a message shown instead */
.desktop-only-message {
    display: none;
}

@media screen and (max-width: 999.98px) {
    .app-shell {
        display: none !important;
    }

    .desktop-only-message {
        display: flex;
        min-height: 100vh;
        align-items: center;
        justify-content: center;
        text-align: center;
        padding: 1rem;
    }
}

/* App layout */
.app-shell {
    display: flex;
    flex-direction: column;
    height: 100vh;
}

.app-topbar {
    display: flex;
    align-items: flex-end;
    gap: 1rem;
    padding: 0.5rem 1rem 0;
    background: var(--bs-tertiary-bg);
    border-bottom: 1px solid var(--bs-border-color);
}

.app-brand {
    font-weight: 600;
    padding-bottom: 0.6rem;
    white-space: nowrap;
}

.building-tabs {
    flex: 1;
    min-width: 0;
    flex-wrap: nowrap;
    overflow-x: auto;
    overflow-y: hidden;
    border-bottom: 0;
    margin-bottom: -1px;
}

.building-tabs .nav-link {
    max-width: 220px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.app-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding-bottom: 0.5rem;
    white-space: nowrap;
}

.app-body {
    flex: 1;
    display: flex;
    min-height: 0;
}

/* Floor tabs: bottom floor at the bottom */
.floor-tabs {
    width: 180px;
    flex-shrink: 0;
    flex-direction: column;
    flex-wrap: nowrap;
    padding: 0.75rem 0.5rem;
    overflow: hidden; /* each section scrolls on its own */
    background: var(--bs-tertiary-bg);
    border-right: 1px solid var(--bs-border-color);
}

/* Two sections: Diagrams on top (at most half the panel, then it scrolls), floors below (the rest). */
.tab-section,
.tab-list {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.diagram-section {
    flex: 0 1 auto;
    max-height: 50%;
    min-height: 0;
    overflow-y: auto;
    padding-bottom: 0.5rem;
    margin-bottom: 0.5rem;
    border-bottom: 1px solid var(--bs-border-color);
}

.floor-section {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
}

.floor-section > :first-child {
    margin-top: auto; /* floors stack from the bottom but still scroll when they overflow */
}

.floor-tabs .nav-link {
    text-align: left;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.floor-tabs .floor-add {
    color: var(--bs-secondary-color);
    font-size: 0.875rem;
}

/* Tab settings (⚙) and drag-to-reorder: edit mode only */
.floor-tab,
.building-tab {
    position: relative;
}

.tab-settings {
    position: absolute;
    top: 50%;
    right: 4px;
    width: 22px;
    height: 22px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: var(--bs-secondary-color);
    font-size: 0.85rem;
    line-height: 1;
    transform: translateY(-50%);
}

.tab-settings:hover {
    background: var(--bs-secondary-bg);
    color: var(--bs-body-color);
}

.floor-tab .nav-link.active + .tab-settings {
    color: rgba(255, 255, 255, 0.85); /* readable on the blue active pill */
}

body.is-editing .floor-tab .nav-link,
body.is-editing .building-tab .nav-link {
    padding-right: 1.9rem; /* room for the ⚙ */
    cursor: grab;
}

.tab-drag-ghost {
    opacity: 0.4;
}

/* (i) next to "Share" in the tab settings: explanation in a tooltip */
.share-info {
    display: inline-flex;
    padding: 0;
    border: 0;
    background: transparent;
    color: var(--bs-secondary-color);
    cursor: help;
}

.share-info:hover,
.share-info:focus-visible {
    color: var(--bs-info);
}

/* Sharing tab: people with access, active links */
.share-heading {
    margin: 1.25rem 0 0.25rem;
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--bs-secondary-color);
}

.share-list {
    max-height: 220px;
    overflow-y: auto;
}

.share-who {
    min-width: 0; /* lets long usernames truncate instead of pushing the buttons out */
}

/* Tabs shared with you: small marker, and they can't be dragged */
.tab-badge {
    margin-left: 0.4rem;
    padding: 0.05rem 0.4rem;
    border-radius: 50rem;
    background: var(--bs-secondary-bg);
    color: var(--bs-secondary-color);
    font-size: 0.7rem;
    vertical-align: middle;
}

body.is-editing .building-tab.is-shared .nav-link {
    cursor: pointer;
}

/* Keeps the floor stack pushed to the bottom when there's no "+ Add floor" (non-owners) */
.floor-tabs-spacer {
    display: block;
}

/* View-only floor: edit mode shows no dashed borders, handles or move cursor on rooms */
body.is-editing .floor-canvas.is-readonly .room {
    border-style: solid;
    cursor: default;
}

.floor-canvas.is-readonly .room-handle {
    display: none !important;
}

/* Floorplan canvas */
.floor-canvas-wrap {
    flex: 1;
    position: relative;
    overflow: auto;
}

.floor-canvas {
    --grid-size: 20px;
    position: relative;
    width: calc(var(--cols) * var(--grid-size));
    height: calc(var(--rows) * var(--grid-size));
}

/* The empty message stays centred in the visible area rather than the whole 3000px canvas */
.floor-canvas .canvas-empty {
    position: fixed;
    inset: auto;
    left: calc(50% + 90px); /* half the floor-tab column */
    top: 50%;
    transform: translate(-50%, -50%);
}

/* Shown only while editing the layout */
.edit-only {
    display: none;
}

body.is-editing .edit-only {
    display: inline-block;
}

/* Palette colors: data-color holds a key from Room::BORDER_COLORS ("" = default grey) */
[data-color] { --color: var(--bs-secondary-color); }
[data-color="blue"] { --color: var(--bs-blue); }
[data-color="green"] { --color: var(--bs-green); }
[data-color="red"] { --color: var(--bs-red); }
[data-color="orange"] { --color: var(--bs-orange); }
[data-color="yellow"] { --color: var(--bs-yellow); }
[data-color="purple"] { --color: var(--bs-purple); }
[data-color="teal"] { --color: var(--bs-teal); }
[data-color="pink"] { --color: var(--bs-pink); }

.color-swatches {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.color-swatch {
    width: 32px;
    height: 32px;
    border: 4px solid var(--color);
    border-radius: 50%;
    cursor: pointer;
}

.btn-check:checked + .color-swatch {
    outline: 2px solid var(--bs-body-color);
    outline-offset: 2px;
}

.btn-check:focus-visible + .color-swatch {
    box-shadow: 0 0 0 0.25rem rgba(var(--bs-primary-rgb), 0.5);
}

/* Rooms: position and size in grid cells (--x, --y, --w, --h) */
.room {
    --room-border: var(--color, var(--bs-secondary-color));
    position: absolute;
    left: calc(var(--x) * var(--grid-size));
    top: calc(var(--y) * var(--grid-size));
    width: calc(var(--w) * var(--grid-size));
    height: calc(var(--h) * var(--grid-size));
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.25rem;
    border: 2px solid var(--room-border);
    border-radius: 12px;
    background: var(--bs-body-bg);
    cursor: pointer; /* opens notes */
}

.room:hover {
    background: var(--bs-tertiary-bg);
}

.room-name {
    max-width: 100%;
    font-size: 0.875rem;
    text-align: center;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Selected room (outside edit mode): its connection lines stand out */
.room.is-selected {
    outline: 2px solid var(--bs-primary);
    outline-offset: 2px;
}

/* Notes button (top-left) with the note count; a faint "+" on rooms without notes, for editors only */
.room-notes-button {
    position: absolute;
    top: 4px;
    left: 4px;
    z-index: 1;
    display: flex;
    align-items: center;
    gap: 3px;
    height: 22px;
    min-width: 22px;
    padding: 0 6px;
    border: 0;
    border-radius: 11px;
    font-size: 0.7rem;
    line-height: 1;
    color: var(--bs-body-color);
    background: var(--bs-secondary-bg);
}

.room-notes-button:hover,
.room-notes-button:focus-visible {
    background: var(--bs-tertiary-bg);
    outline: 1px solid var(--bs-border-color);
}

.room-notes-button.is-empty {
    justify-content: center;
    padding: 0;
    font-size: 0.9rem;
    color: var(--bs-secondary-color);
    background: transparent;
    opacity: 0.5;
}

.room-notes-button.is-empty:hover,
.room-notes-button.is-empty:focus-visible {
    opacity: 1;
}

.floor-canvas.is-readonly .room-notes-button.is-empty,
body.is-editing .room-notes-button {
    display: none;
}

/* Category mode lists note names from the left: keep the room name clear of the notes button */
.room.shows-notes .room-name {
    padding-left: 1.75rem;
}

/* Booking icon on reservable rooms: green = free now, red = booked now. Hidden in edit mode and when
   the Show dropdown lists a category's notes. */
.room-book {
    position: absolute;
    top: 4px;
    right: 4px;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    color: var(--bs-success);
    background: rgba(var(--bs-success-rgb), 0.2);
}

.room-book:hover,
.room-book:focus-visible {
    background: rgba(var(--bs-success-rgb), 0.4);
}

.room-book.is-busy {
    color: var(--bs-danger);
    background: rgba(var(--bs-danger-rgb), 0.2);
}

.room-book.is-busy:hover,
.room-book.is-busy:focus-visible {
    background: rgba(var(--bs-danger-rgb), 0.4);
}

body.is-editing .room-book,
body.shows-category .room-book,
.room.is-tiny .room-book {
    display: none;
}

.room.is-narrow .room-book {
    top: auto;
    bottom: 4px;
}

/* Booking modal: day schedule (one row per 15 minutes) beside the form */
.booking-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 1rem;
}

.booking-day {
    height: 400px;
    overflow-y: auto;
    border: 1px solid var(--bs-border-color);
    border-radius: var(--bs-border-radius);
}

.booking-grid {
    position: relative;
    margin-left: 3.25rem;
    cursor: pointer;
    /* a line every hour (4 rows of 12px) */
    background-image: repeating-linear-gradient(to bottom, var(--bs-border-color) 0 1px, transparent 1px 48px);
}

.booking-hour {
    position: absolute;
    left: -3.25rem;
    width: 2.75rem;
    padding-top: 1px;
    font-size: 0.7rem;
    text-align: right;
    color: var(--bs-secondary-color);
    pointer-events: none;
}

.booking-past {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    background: repeating-linear-gradient(135deg, rgba(var(--bs-secondary-rgb), 0.15) 0 6px, transparent 6px 12px);
    cursor: default;
}

.booking-selection {
    position: absolute;
    left: 4px;
    right: 4px;
    border: 2px dashed var(--bs-primary);
    border-radius: 6px;
    background: rgba(var(--bs-primary-rgb), 0.12);
    pointer-events: none;
}

.booking-block {
    position: absolute;
    left: 4px;
    right: 4px;
    z-index: 1;
    overflow: hidden;
    padding: 0 6px;
    border-left: 4px solid var(--bs-secondary-color);
    border-radius: 6px;
    font-size: 0.75rem;
    line-height: 1.35;
    white-space: nowrap;
    text-overflow: ellipsis;
    background: var(--bs-secondary-bg);
    cursor: pointer;
}

.booking-block.is-mine {
    border-left-color: var(--bs-primary);
    background: rgba(var(--bs-primary-rgb), 0.25);
}

.booking-block.is-series {
    border-left-color: var(--bs-info);
}

.booking-block.is-selected {
    outline: 2px solid var(--bs-body-color);
}

.booking-details-description {
    white-space: pre-wrap;
}

/* Recurring booking saved with clashes: the dates that won't go through */
.series-clash-list {
    max-height: 40vh;
    overflow-y: auto;
    padding-left: 1.1rem;
}

/* Markers (js/markers.js): icons on grid cells, above rooms and lines. General ones always full; category ones
   slightly muted, full while their category is chosen under Show, faint while another category is. */
.marker-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 3;
    pointer-events: none;
}

.marker {
    position: absolute;
    left: calc(var(--x) * var(--grid-size));
    top: calc(var(--y) * var(--grid-size));
    display: flex;
    align-items: center;
    justify-content: center;
    width: var(--grid-size);
    height: var(--grid-size);
    padding: 0;
    border: 0;
    border-radius: 50%;
    color: var(--color);
    background: var(--bs-body-bg);
    box-shadow: 0 0 0 1px var(--bs-border-color);
    pointer-events: auto;
    cursor: pointer;
    transition: opacity 0.15s ease;
}

.marker svg {
    width: 15px;
    height: 15px;
}

.marker.is-muted {
    opacity: 0.64; /* no category chosen under Show: clearly visible, a touch quieter than General markers */
}

.marker.is-faint {
    opacity: 0.32; /* another category is chosen under Show */
}

.marker.is-focused,
.marker.is-open {
    z-index: 1;
    box-shadow: 0 0 0 2px var(--color);
}

body.is-editing .marker {
    cursor: move;
}

.marker.is-dragging {
    z-index: 2;
    opacity: 0.9;
}

.marker.is-invalid {
    box-shadow: 0 0 0 2px var(--bs-danger);
}

body.is-placing .floor-canvas,
body.is-placing .floor-canvas * {
    cursor: crosshair !important;
}

.marker-popover-description {
    white-space: pre-wrap;
}

.marker-icon-choices {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}

.marker-icon-choice {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border: 1px solid var(--bs-border-color);
    border-radius: var(--bs-border-radius);
    color: var(--bs-body-color);
    cursor: pointer;
}

.btn-check:checked + .marker-icon-choice {
    border-color: var(--bs-primary);
    color: var(--bs-primary);
    background: rgba(var(--bs-primary-rgb), 0.2);
}

.btn-check:focus-visible + .marker-icon-choice {
    box-shadow: 0 0 0 0.25rem rgba(var(--bs-primary-rgb), 0.5);
}

/* Connection lines (js/lines.js): subtle by default; lines of the selected or hovered room stand out */
.connection-layer {
    position: absolute;
    top: 0;
    left: 0;
    z-index: 2;
    overflow: visible;
    pointer-events: none;
}

.connection {
    opacity: 0.64;
    transition: opacity 0.15s ease;
}

.connection-layer.has-focus .connection {
    opacity: 0.16;
}

.connection-layer .connection.is-highlighted {
    opacity: 1;
}

.connection-line {
    fill: none;
    stroke: var(--color);
    stroke-width: 1.5;
    stroke-linejoin: round;
}

.connection.is-highlighted .connection-line {
    stroke-width: 3;
}

/* Doors (js/lines.js): a gap in the room's wall, marked at both ends */
.door-layer {
    position: absolute;
    top: 0;
    left: 0;
    z-index: 1;
    overflow: visible;
    pointer-events: none;
}

.door-gap {
    fill: var(--bs-body-bg);
}

.door-jamb {
    stroke: var(--color);
    stroke-width: 2;
    stroke-linecap: round;
}

.connection.is-unrouted .connection-line {
    stroke-dasharray: 6 4;
}

.connection-arrow-head {
    fill: var(--color);
}

.connection-label {
    display: none;
    font-size: 11px;
    fill: var(--bs-body-color);
    paint-order: stroke;
    stroke: var(--bs-body-bg);
    stroke-width: 3px;
    stroke-linejoin: round;
}

.connection.is-highlighted .connection-label {
    display: inline;
}

/* Connections tab of the room modal: each row = the connection (click to edit) + a small delete button */
.connection-open {
    flex: 1 1 auto;
    min-width: 0;
    padding: 0.5rem 0.25rem;
    border: 0;
    text-align: left;
    color: inherit;
    background: transparent;
}

.connection-row.active,
.connection-open:hover {
    background: var(--bs-tertiary-bg);
}

.connection-delete {
    flex-shrink: 0;
    margin-right: 0.25rem;
    padding: 0.1rem 0.4rem;
    line-height: 1;
}

.connection-arrow {
    flex-shrink: 0;
    width: 1.25rem;
    text-align: center;
    font-weight: 600;
}

.connection-editor {
    margin-top: 0.75rem;
    padding: 0.75rem;
    border: 1px solid var(--bs-border-color);
    border-radius: var(--bs-border-radius);
}

/* "Pick on the floor": the next room clicked becomes the other end of a connection */
body.is-picking .floor-canvas .room,
body.is-picking .floor-canvas .room * {
    cursor: crosshair !important;
}

.pick-banner {
    position: fixed;
    top: 0.75rem;
    left: 50%;
    z-index: 1100;
    transform: translateX(-50%);
    padding: 0.5rem 1rem;
    border-radius: var(--bs-border-radius);
    font-size: 0.875rem;
    color: var(--bs-body-color);
    background: var(--bs-primary-bg-subtle);
    border: 1px solid var(--bs-primary-border-subtle);
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.3);
}

/* Top-bar search */
.search-box {
    position: relative;
}

.search-box .form-control {
    width: 11rem;
    transition: width 0.15s ease;
}

.search-box .form-control:focus {
    width: 16rem;
}

.search-results {
    top: 100%;
    right: 0;
    left: auto;
    width: 26rem;
    max-height: 60vh;
    overflow-y: auto;
    margin-top: 0.25rem;
}

.search-result {
    white-space: normal;
}

.search-result-title {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    min-width: 0;
}

.search-result-where,
.search-result-snippet {
    font-size: 0.75rem;
    color: var(--bs-secondary-color);
}

.search-result.active .search-result-where,
.search-result.active .search-result-snippet {
    color: inherit;
}

.search-result-snippet {
    font-style: italic;
}

.search-message {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    color: var(--bs-secondary-color);
}

/* Rooms on this floor matching the search text; a room opened from a search result pulses */
.room.is-match {
    box-shadow: 0 0 0 3px rgba(var(--bs-warning-rgb), 0.85);
}

.room.is-found {
    animation: room-found 0.8s ease-in-out 3;
}

@keyframes room-found {
    0%, 100% { box-shadow: 0 0 0 0 rgba(var(--bs-primary-rgb), 0); }
    50% { box-shadow: 0 0 0 8px rgba(var(--bs-primary-rgb), 0.7); }
}

/* "Show" dropdown: a category's note names listed in each room; rooms without any are dimmed */
.room-label-picker {
    width: auto;
    flex-wrap: nowrap;
}

.room-label-picker .form-select {
    max-width: 11rem;
}

.room.shows-notes {
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    gap: 0.125rem;
    padding: 0.25rem 0.5rem;
}

.room.shows-notes .room-name {
    flex-shrink: 0;
    font-weight: 600;
    text-align: left;
}

.room-notes {
    flex: 1 1 auto;
    min-height: 0;
    margin: 0;
    padding: 0;
    overflow: hidden;
    list-style: none;
    font-size: 0.75rem;
    line-height: 1.3;
}

.room-notes li {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    white-space: nowrap;
}

.room-notes li > span:last-child {
    overflow: hidden;
    text-overflow: ellipsis;
}

.room-notes .category-dot {
    width: 8px;
    height: 8px;
}

.room-notes-more {
    color: var(--bs-secondary-color);
}

.room.is-dimmed {
    opacity: 0.35;
}

body.is-editing .room {
    border-style: dashed;
    cursor: move;
    user-select: none;
}

/* Moving: the room floats above others; red while it overlaps something (dropping there snaps back) */
body.is-moving,
body.is-moving * {
    cursor: grabbing !important;
    user-select: none;
}

.room.is-moving {
    z-index: 3;
    border-style: solid;
    border-color: var(--bs-primary);
    box-shadow: 0 0.5rem 1.5rem rgba(0, 0, 0, 0.35);
    opacity: 0.92;
}

.room.is-moving.is-invalid {
    border-color: var(--bs-danger);
    background: var(--bs-danger-bg-subtle);
}

/* Resize handles (edit mode only) */
.room-handle {
    position: absolute;
    display: none;
    z-index: 2;
    touch-action: none;
}

body.is-editing .room-handle {
    display: block;
}

.room-handle-e {
    top: 8px;
    bottom: 8px;
    right: -6px;
    width: 10px;
    cursor: ew-resize;
}

.room-handle-s {
    left: 8px;
    right: 8px;
    bottom: -6px;
    height: 10px;
    cursor: ns-resize;
}

.room-handle-se {
    right: -6px;
    bottom: -6px;
    width: 14px;
    height: 14px;
    border-radius: 3px;
    background: var(--bs-primary);
    cursor: nwse-resize;
}

/* While dragging: keep the resize cursor everywhere and show the size */
body.is-resizing-e,
body.is-resizing-e * {
    cursor: ew-resize !important;
}

body.is-resizing-s,
body.is-resizing-s * {
    cursor: ns-resize !important;
}

body.is-resizing-se,
body.is-resizing-se * {
    cursor: nwse-resize !important;
}

body[class*="is-resizing-"] {
    user-select: none;
}

.room.is-resizing {
    z-index: 3;
    border-color: var(--bs-primary);
    border-style: solid;
}

.room-size {
    display: none;
    position: absolute;
    right: 6px;
    bottom: 4px;
    font-size: 0.75rem;
    font-family: var(--bs-font-monospace);
    color: var(--bs-primary);
}

.room.is-resizing .room-size {
    display: block;
}

body.is-editing .floor-canvas {
    background-image:
        linear-gradient(to right, var(--bs-border-color-translucent) 1px, transparent 1px),
        linear-gradient(to bottom, var(--bs-border-color-translucent) 1px, transparent 1px);
    background-size: var(--grid-size) var(--grid-size);
}

.canvas-empty {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--bs-secondary-color);
    pointer-events: none;
}

.canvas-empty .btn {
    pointer-events: auto;
}

/* Notes modal: one row per category — label column, then that category's pills */
.note-rows {
    --note-label-width: 140px;
    --note-row-gap: 0.75rem;
}

.note-group {
    padding: 0.6rem 0;
}

.note-group + .note-group {
    border-top: 1px solid var(--bs-border-color-translucent);
}

.note-row {
    display: flex;
    align-items: flex-start;
    gap: var(--note-row-gap);
}

.note-row-label {
    flex: 0 0 var(--note-label-width);
    min-width: 0;
    height: 32px;
    display: flex;
    align-items: center;
    gap: 0.45rem;
    font-size: 0.875rem;
    font-weight: 600;
}

.note-row-label-text {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.note-row-pills {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}

.note-pill {
    height: 32px;
    min-width: 64px;
    max-width: 220px;
    padding: 0 0.85rem;
    border: 2px solid var(--color);
    border-radius: 50rem;
    background: var(--bs-body-bg);
    color: var(--bs-body-color);
    font-size: 0.875rem;
    text-align: center;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.note-pill:hover {
    background: var(--bs-tertiary-bg);
}

.note-pill.is-selected {
    background: var(--color);
    color: var(--bs-dark);
    font-weight: 600;
}

.note-pill:focus-visible,
.note-pill-add:focus-visible {
    outline: 2px solid var(--bs-body-color);
    outline-offset: 2px;
}

.note-pill-add {
    width: 32px;
    height: 32px;
    border: 2px dashed var(--bs-border-color);
    border-radius: 50%;
    background: transparent;
    color: var(--bs-secondary-color);
    line-height: 1;
}

.note-pill-add:hover {
    border-color: var(--bs-secondary-color);
    color: var(--bs-body-color);
}

/* Note popover: capped size; long descriptions scroll inside it */
.note-popover {
    --bs-popover-max-width: 320px;
}

.note-popover .popover-header {
    overflow-wrap: anywhere;
}

.note-popover-description {
    max-height: 240px;
    margin-bottom: 0.6rem;
    overflow-y: auto;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.category-dot {
    width: 10px;
    height: 10px;
    flex-shrink: 0;
    border-radius: 50%;
    background: var(--color);
}

/* Migrations */
.migration-sql {
    white-space: pre-wrap;
}


/* ---- Printing (js/print.js): the current floor as shown, cropped and scaled to one A4 landscape page ---- */
.print-only {
    display: none;
}

@media print {
    @page {
        size: A4 landscape;
        margin: 10mm;
    }

    * {
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    html,
    body {
        height: auto;
        background: #fff;
    }

    .app-topbar,
    .floor-tabs,
    .desktop-only-message,
    .modal,
    .modal-backdrop,
    .popover,
    .tooltip,
    .pick-banner,
    .room-notes-button,
    .room-book,
    .room-handle,
    .room-size,
    .canvas-empty {
        display: none !important;
    }

    .app-shell,
    .app-body {
        display: block;
        height: auto;
    }

    .floor-canvas-wrap {
        position: relative;
        flex: none;
        overflow: hidden;
    }

    body.is-editing .floor-canvas {
        background-image: none; /* no edit grid on paper */
    }

    body.is-editing .room {
        border-style: solid;
    }

    .print-only {
        display: block;
    }

    .print-header {
        height: 40px;
        margin-bottom: 4px;
    }

    .print-title {
        font-size: 16pt;
        font-weight: 600;
        line-height: 1.2;
    }

    .print-details {
        font-size: 9pt;
        color: #555;
    }

    .print-legend {
        display: flex;
        flex-wrap: wrap;
        gap: 4px 16px;
        margin-top: 8px;
        font-size: 9pt;
    }

    .print-legend-item {
        display: inline-flex;
        align-items: center;
        gap: 5px;
    }

    .print-legend-icon {
        display: inline-flex;
        color: var(--color);
    }

    .print-legend-icon svg {
        width: 16px;
        height: 16px;
    }
}
