.lane-board {
    display: flex;
    gap: 1rem;
    overflow-x: auto;
    padding-bottom: 1rem;
    align-items: flex-start;
}

/* A viewer's board and task dialog: everything that changes something is hidden. */
.read-only .edit-only, .read-only .add-task-btn,
.read-only .lane-header .dropdown, .read-only .section-heading .dropdown { display: none !important; }
.board-card-support .card-title { color: var(--bs-danger); }
.board-card-support { border-color: var(--bs-danger-border-subtle); }

/* The board scrolls inside itself, both ways (its height is set by fitLaneBoard in
   board.js), so the lane headers can stick to its top. Columns stretch to its height. */
.lane-board { overflow: auto; padding-bottom: 0; }
.lane-heads { position: sticky; top: 0; z-index: 10; background: var(--bs-body-bg); padding-bottom: 0.25rem; }

.lane {
    background: var(--bs-tertiary-bg);
    border: 1px solid var(--bs-border-color);
    border-radius: 0.5rem;
    min-width: 280px;
    max-width: 280px;
    padding: 0.75rem;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
}

.lane > .lane-header { position: sticky; top: -0.75rem; z-index: 10; background: var(--bs-tertiary-bg); padding-top: 0.75rem; margin-top: -0.75rem; }
.lane-header {
    cursor: grab;
    padding-bottom: 0.5rem;
    margin-bottom: 0.5rem;
    border-bottom: 1px solid var(--bs-border-color);
}

.lane-tasks {
    flex: 1;
    min-height: 40px;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.task-card {
    position: relative;
    background: var(--bs-body-bg);
    border: 1px solid var(--bs-border-color);
    border-radius: 0.375rem;
    padding: 0.5rem 0.65rem;
    cursor: pointer;
}

/* "Isolate" button, top right of a card that has sub-items. */
.focus-btn {
    position: absolute; top: 0.3rem; right: 0.3rem; z-index: 2;
    border: 0; border-radius: 0.25rem; padding: 0.1rem 0.3rem; line-height: 1;
    background: var(--bs-body-bg); color: var(--bs-secondary-color); opacity: 0.75;
}
.focus-btn:hover, .focus-btn:focus-visible, .task-card:hover .focus-btn { opacity: 1; color: var(--bs-primary); }
.task-card.has-focus-btn .task-title { padding-right: 1.4rem; }

/* An archived task (only drawn while "Show archived" is on). */
.task-card.task-archived { opacity: 0.55; border-style: dashed; }

.task-card:hover {
    border-color: var(--bs-primary);
}

.task-ghost {
    opacity: 0.4;
}

.task-title {
    font-size: 0.9rem;
}

.task-tag {
    font-size: 0.7rem;
    color: #fff;
}

.board-card {
    cursor: pointer;
    transition: border-color 0.15s ease;
}

.board-card:hover {
    border-color: var(--bs-primary);
}

/* The confirm/prompt dialogs can open over the task or tag modal. Bootstrap
   puts every backdrop at one z-index, so lift the second backdrop (and the
   dialogs themselves) above the first modal. */
.modal-backdrop ~ .modal-backdrop { z-index: 1070; }
#confirmModal, #promptModal, #previewModal { z-index: 1075; }
#previewBody img { max-width: 100%; max-height: 75vh; object-fit: contain; }
#previewBody iframe { width: 100%; height: 75vh; border: 0; }
#previewBody pre { text-align: left; margin: 0; padding: 1rem; white-space: pre-wrap; word-break: break-word; }
.attachment-open { cursor: pointer; }

/* Group bands: an expanded card (which stays a card in its lane) also gets a band of its own:
   a header bar over its sub-items' lane cells, boxed together in the lane's colour
   (--group-color, set inline from the parent's lane). */
.group-band { position: relative; isolation: isolate; display: flex; flex-direction: column; gap: 0.5rem;
    margin: 0.85rem 0 0.6rem; --group-color: var(--bs-info); scroll-margin-top: 4.5rem; }
/* The box is drawn outside the band so the lane cells keep lining up with the lane headers. */
.group-band::before { content: ""; position: absolute; inset: -0.5rem; z-index: -1; pointer-events: none;
    border: 2px solid var(--group-color); border-radius: 0.7rem;
    background: color-mix(in srgb, var(--group-color) 9%, transparent); }
.group-bar { background: color-mix(in srgb, var(--group-color) 30%, var(--bs-secondary-bg));
    border-left: 4px solid var(--group-color); border-radius: 0.375rem; padding: 0.4rem 0.75rem; cursor: grab; }
/* Content stays in view while the lanes scroll sideways, like a section's title. */
.group-bar-inner { position: sticky; left: 0.75rem; z-index: 6; display: inline-flex; align-items: center; gap: 0.5rem; }
.group-title { font-weight: 600; cursor: pointer; }
.group-cover { width: 36px; height: 36px; object-fit: cover; border-radius: 0.25rem; }
.read-only .group-title { cursor: default; }
.band-grid { padding: 0 0.6rem; }

/* The card that was expanded: brighter edge in its lane's colour; its click goes to the group. */
.task-card.task-expanded { --group-color: var(--bs-info); border-color: color-mix(in srgb, var(--group-color) 70%, white);
    box-shadow: 0 0 0 2px color-mix(in srgb, var(--group-color) 70%, white); }
.task-card { scroll-margin-top: 4.5rem; }
@keyframes group-flash { 0%, 60% { box-shadow: 0 0 0 4px var(--bs-warning); } 100% { box-shadow: 0 0 0 0 transparent; } }
.flash { animation: group-flash 1.5s ease-out; }

.min-w-0 {
    min-width: 0;
}

/* Cover picture on a card: the first image attached to the task. */
.task-cover {
    display: block;
    width: 100%;
    height: 120px;
    object-fit: cover;
    border-radius: 0.25rem;
    margin-bottom: 0.4rem;
    background: var(--bs-tertiary-bg);
}

/* A task's checklist drawn on its card (checklistHtml in board.js). */
.card-checklist .card-check { cursor: pointer; line-height: 1.25; margin-top: 0.15rem; }
.card-checklist .card-check-input { flex-shrink: 0; cursor: pointer; }

/* Sections: bands across all lanes (see "sections" in board.js). */
.band-grid { display: flex; flex-direction: column; gap: 0.75rem; min-width: max-content; min-height: 100%; }
.lane-columns { display: flex; gap: 1rem; align-items: stretch; min-width: max-content; min-height: 100%; }
.lane-heads, .section-row, .group-row { display: flex; gap: 1rem; align-items: stretch; }
.lane-head, .lane-cell { flex: 0 0 280px; width: 280px; }
.lane-head .lane-header { background: var(--bs-tertiary-bg); border: 1px solid var(--bs-border-color);
    border-radius: 0.5rem; padding: 0.5rem 0.75rem; margin: 0; }
.lane-cell { background: var(--bs-tertiary-bg); border: 1px solid var(--bs-border-color);
    border-radius: 0.5rem; padding: 0.6rem; min-height: 64px; display: flex; flex-direction: column; }
.band-list { display: flex; flex-direction: column; gap: 1rem; flex: 1; }
.section-band { display: flex; flex-direction: column; }
/* The last band, and whatever is last inside it, fills the board's height. */
.section-band:last-child:not(.collapsed) { flex: 1; }
.section-band:last-child:not(.collapsed) > :last-child, .group-band > :last-child { flex: 1; }
.section-heading { background: var(--bs-secondary-bg); border-left: 4px solid var(--bs-primary);
    border-radius: 0.375rem; padding: 0.4rem 0.75rem; margin-bottom: 0.5rem; cursor: grab; }
/* The title stays in view while the lanes scroll sideways under it. */
/* z-index keeps its menu above the position:relative task cards in the cells below. */
.section-heading-inner { position: sticky; left: 0.75rem; z-index: 6; }
.section-band.collapsed .section-heading { margin-bottom: 0; }
.section-band > .section-heading { flex: none; }

/* The cover image at the top of an open task (renderTaskCover in board.js). */
.task-cover-wrap { background: var(--bs-tertiary-bg); border-radius: 0.5rem; text-align: center; cursor: zoom-in; overflow: hidden; }
.task-cover-wrap img { max-width: 100%; max-height: 45vh; object-fit: contain; display: block; margin: 0 auto; }

/* @mentions (see "mentions" in board.js). */
.mention-chip { background: color-mix(in srgb, var(--bs-primary) 22%, transparent); color: var(--bs-primary-text-emphasis);
    border-radius: 0.75rem; padding: 0 0.4rem; white-space: nowrap; }
.mention-chip.me { background: var(--bs-warning); color: #000; font-weight: 600; }
.mention-menu { position: fixed; z-index: 1090; min-width: 12rem; max-width: 20rem; max-height: 14rem; overflow-y: auto; }
.mention-menu .list-group-item { cursor: pointer; padding: 0.35rem 0.75rem; }
.mention-entry { cursor: pointer; }
.mention-entry.unseen { border-left: 3px solid var(--bs-warning); padding-left: 0.5rem; }

/* Lane colours: --lane-color is set inline on a lane's header and cells (laneStyle in board.js). */
.lane, .lane-head, .lane-cell { --lane-color: var(--bs-secondary-color); }
.lane-head .lane-header { border-top: 4px solid var(--lane-color);
    background: color-mix(in srgb, var(--lane-color) 16%, var(--bs-tertiary-bg)); }
.lane-cell { border-top: 3px solid color-mix(in srgb, var(--lane-color) 70%, transparent); }
.lane { border-top: 4px solid var(--lane-color); }
.lane > .lane-header { background: color-mix(in srgb, var(--lane-color) 16%, var(--bs-tertiary-bg)); }
.lane-swatches { display: grid; grid-template-columns: repeat(5, 1.5rem); gap: 0.35rem; }
.lane-swatch { width: 1.5rem; height: 1.5rem; border-radius: 50%; border: 2px solid transparent; padding: 0; cursor: pointer; }
.lane-swatch.active { border-color: var(--bs-body-color); }
.lane-swatch:hover { border-color: var(--bs-secondary-color); }
