/* BACKENDUP-429: Bootstrap's default link ink (#0d6efd) is 4.50:1 on pure white and 4.27:1
   on the `bg-light` cards the notification centre paints its unread rows with, which is the
   whole margin gone. Measured on the rendered page, not inferred: 'Unread', 'Direct message',
   'Open conversation' and every subject link in a card sat at 4.27:1 against rgb(248,249,250),
   and `.btn-outline-secondary`'s ink sat at 4.45:1. Both are body-size text, so the floor is
   4.5:1 and both were under it. Darkened one shade - Bootstrap's own primary-600 / a slate
   grey - so the link colour is the app's on white and still clears the floor on a tinted
   surface. The contrast audit in `core/e2e.py` is what found this; it fails the build if any
   of these drift back. */
:root {
    --bs-link-color: #0a58ca;
    --bs-link-color-rgb: 10, 88, 202;
    --bs-link-hover-color: #084298;
    --bs-link-hover-color-rgb: 8, 66, 152;
    /* `.text-primary` and `.link-primary` are `!important` utilities that read the primary
       triplet, not the link token, so the link alone was not enough: the 'Unread' marker and
       every subject link inside a notification card kept measuring 4.27:1 until the primary
       itself moved. One shade darker is Bootstrap's own primary-600, which also lifts
       white-on-primary from 4.50:1 - exactly on the line, no margin at all - to 6.44:1:
       the "badges on the primary colour" case the item names, measured from both sides. */
    --bs-primary: #0a58ca;
    --bs-primary-rgb: 10, 88, 202;
}

.btn-outline-secondary {
    --bs-btn-color: #556070;
}

/* `.btn-outline-primary` hard-codes its ink instead of reading the token, so the 'Open
   discussion' control on every unread notification card was still 4.27:1 after the tokens
   moved. Same value, one source. */
.btn-outline-primary {
    --bs-btn-color: var(--bs-link-color);
    --bs-btn-hover-color: var(--bs-link-hover-color);
}

/* Base Styles */
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    line-height: 1.6;
    color: #333;
}

/* Hero Section */
.hero-section {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 100px 0;
}

.hero-section h1 {
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

/* Cards */
.feature-card {
    border: none;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease;
}

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

.feature-card:hover {
    transform: translateY(-5px);
}

.card {
    border: none;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Feature Icons */
.feature-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.feature-image {
    width: 100%;
    max-width: 220px;
    aspect-ratio: 16 / 10;
    object-fit: cover;
    border-radius: 8px;
}

/* Navigation */
.navbar {
    /* Center the inner container once it hits Bootstrap's max-width. */
    justify-content: center;
}

.navbar > .container {
    /* `.navbar` is a flex container, so the child `.container` shrink-wraps
       to the logo/search/account cluster instead of using the same max-width
       as page content. Fill the shared Bootstrap container grid. */
    flex: 1 0 100%;
}

@media (min-width: 992px) {
    /* Brand (+ apps when they fit) | centered search | account or toggler.
       Equal side columns keep the search on the page midline. Work/Discussions
       stay in the hamburger until xxl so they cannot paint over the search. */
    .navbar > .container:has(.global-search-navigation) {
        display: grid;
        grid-template-columns: minmax(0, 1fr) minmax(0, 34rem) minmax(0, 1fr);
        align-items: center;
        column-gap: 0.75rem;
        row-gap: 0.25rem;
    }

    .navbar > .container:has(.global-search-navigation) .navbar-start {
        grid-column: 1;
        justify-self: start;
    }

    .navbar > .container:has(.global-search-navigation) .global-search-navigation {
        grid-column: 2;
        width: min(34rem, 100%);
        max-width: 100%;
        min-width: 0;
        margin-left: 0;
        margin-right: 0;
        justify-self: center;
    }

    .navbar > .container:has(.global-search-navigation) .navbar-toggler {
        grid-column: 3;
        justify-self: end;
    }

    .navbar > .container:has(.global-search-navigation) .navbar-collapse {
        grid-column: 1 / -1;
        justify-content: flex-end;
        justify-self: stretch;
    }
}

@media (min-width: 1400px) {
    .navbar > .container:has(.global-search-navigation) .navbar-collapse {
        grid-column: 3;
        grid-row: 1;
    }
}

.navbar-start {
    display: flex;
    align-items: center;
    min-width: 0;
    gap: 0.35rem;
}

.navbar-app-switcher {
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: center;
}

.navbar-app-switcher .nav-link {
    font-weight: 600;
}

.navbar-dark .navbar-app-switcher .nav-link.active {
    color: #fff;
    box-shadow: inset 0 -2px 0 currentColor;
}

.navbar-discussions-link {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}

.navbar-discussions-link [data-notification-bell-count] {
    font-size: 0.65rem;
}

.navbar-brand {
    font-size: 1.5rem;
    font-weight: bold;
}

.global-search-navigation {
    display: flex;
    align-items: center;
    width: min(34rem, 42vw);
    margin-left: auto;
    margin-right: 1rem;
}

.global-search-trigger,
.global-search-compact-trigger {
    color: #dfe5ed;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.22);
}

.global-search-trigger {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
    min-height: 2.25rem;
    padding: 0.375rem 0.625rem;
    border-radius: 0.5rem;
    text-align: left;
}

.global-search-trigger:hover,
.global-search-trigger:focus-visible,
.global-search-compact-trigger:hover,
.global-search-compact-trigger:focus-visible {
    color: #fff;
    background: rgba(255, 255, 255, 0.14);
    border-color: rgba(255, 255, 255, 0.45);
}

.global-search-icon {
    flex: 0 0 auto;
    font-size: 1.35rem;
    line-height: 1;
}

.global-search-prompt {
    overflow: hidden;
    flex: 1 1 auto;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.global-search-shortcut,
.global-search-dialog-footer kbd,
.global-search-toast kbd {
    padding: 0.1rem 0.35rem;
    color: inherit;
    background: rgba(255, 255, 255, 0.12);
    border-radius: 0.25rem;
    font-family: inherit;
    font-size: 0.75rem;
}

.global-search-hide,
.global-search-close {
    border: 0;
    background: transparent;
    line-height: 1;
}

.global-search-hide {
    margin-left: 0.25rem;
    padding: 0.25rem;
    color: #b6c0cc;
    font-size: 1.35rem;
}

.global-search-hide:hover,
.global-search-hide:focus-visible {
    color: #fff;
}

.global-search-compact-trigger {
    display: none;
    width: 2.25rem;
    height: 2.25rem;
    margin-left: auto;
    border-radius: 0.5rem;
    font-size: 1.25rem;
}

.global-search-overlay {
    position: fixed;
    z-index: 1080;
    inset: 0;
    display: grid;
    align-items: start;
    justify-items: center;
    padding: min(14vh, 8rem) 1rem 1rem;
    background: rgba(20, 27, 38, 0.58);
}

.global-search-dialog {
    width: min(42rem, 100%);
    max-height: calc(100vh - 2rem);
    max-height: calc(100dvh - 2rem);
    overflow: hidden;
    border: 1px solid #d7dde6;
    border-radius: 0.75rem;
    background: #fff;
    box-shadow: 0 1.25rem 4rem rgba(0, 0, 0, 0.25);
    display: flex;
    flex-direction: column;
}

.global-search-dialog-header {
    display: grid;
    flex: 0 1 auto;
    grid-template-columns: auto minmax(0, 1fr) auto;
    min-height: 0;
    align-items: center;
    gap: 0.625rem;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 0.75rem 0.875rem;
    border-bottom: 1px solid #e5e9ef;
}

.global-search-dialog-header .global-search-icon {
    color: #596579;
}

.global-search-input {
    width: 100%;
    min-width: 0;
    border: 0;
    outline: 0;
    color: #1f2c40;
    font-size: 1.05rem;
}

.global-search-input:focus {
    box-shadow: none;
}

.global-search-close {
    padding: 0.2rem 0.35rem;
    color: #596579;
    border-radius: 0.25rem;
    font-size: 1.5rem;
}

.global-search-close:hover,
.global-search-close:focus-visible {
    color: #1f2c40;
    background: #edf1f5;
}

.global-search-overlay-tools {
    display: flex;
    grid-column: 1 / -1;
    align-items: center;
    gap: 0.5rem;
    padding-top: 0.125rem;
}

.global-search-overlay-scope,
.global-search-filter-toggle,
.global-search-filter-panel select,
.global-search-filter-panel input:not([type='checkbox']):not([type='radio']),
.global-search-filter-panel .backlog-filter-multiselect-toggle {
    min-height: 2rem;
    border: 1px solid #cbd4e0;
    border-radius: 0.375rem;
    background: #fff;
    color: #344257;
    font: inherit;
    font-size: 0.875rem;
}

.global-search-overlay-scope {
    min-width: 9rem;
    padding: 0.25rem 0.5rem;
}

.global-search-filter-toggle {
    padding: 0.25rem 0.625rem;
    color: #4f46c9;
    border-color: #c8c5f0;
    background: #f7f6ff;
    font-weight: 700;
}

.global-search-filter-toggle:hover,
.global-search-filter-toggle:focus-visible {
    color: #3730a3;
    border-color: #9690de;
    background: #efedff;
}

.global-search-filter-panel {
    grid-column: 1 / -1;
    margin: 0.125rem -0.875rem -0.75rem;
    padding: 0.875rem;
    border-top: 1px solid #e5e9ef;
    background: #f8f9fb;
}

.global-search-filter-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.625rem;
}

.global-search-filter-grid > .backlog-filter-field,
.global-search-filter-grid > .backlog-filter-multiselect {
    display: flex;
    flex-direction: column;
    gap: 0;
    min-width: 0;
    color: #596579;
    font-size: 0.75rem;
    font-weight: 700;
}

.global-search-filter-grid .backlog-filter-field-label,
.global-search-filter-grid .backlog-filter-multiselect > legend {
    font-size: 0.75rem;
}

.global-search-filter-panel select,
.global-search-filter-panel input:not([type='checkbox']):not([type='radio']),
.global-search-filter-panel .backlog-filter-multiselect-toggle {
    width: 100%;
    min-width: 0;
    height: 2rem;
    min-height: 2rem;
    padding: 0.25rem 0.45rem;
    font-size: 0.875rem;
    font-weight: 400;
}

.global-search-filter-panel .backlog-filter-checkbox {
    display: inline-flex;
    flex-direction: row;
    align-items: center;
    gap: 0.45rem;
    font-size: 0.8125rem;
    font-weight: 500;
    color: #374151;
}

.global-search-filter-panel .backlog-filter-checkbox .form-check-input {
    width: 1em;
    height: 1em;
    min-height: 1em;
    margin: 0;
    padding: 0;
    flex: 0 0 auto;
}

.global-search-filter-panel .backlog-filter-field > .form-control,
.global-search-filter-panel .backlog-filter-field > input,
.global-search-filter-panel .backlog-filter-multiselect-shell {
    margin-top: 0.2rem;
}

.global-search-filter-panel select:disabled,
.global-search-filter-panel .backlog-filter-multiselect-toggle:disabled {
    color: #8a94a5;
    background: #edf1f5;
}

.global-search-filter-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.75rem;
    color: #657287;
    font-size: 0.75rem;
}

.global-search-filter-actions button {
    padding: 0;
    color: #4f46c9;
    border: 0;
    background: transparent;
    font: inherit;
    font-weight: 700;
    text-decoration: underline;
}

.global-search-dialog-body {
    flex: 1 1 auto;
    min-height: 6.5rem;
    max-height: min(44vh, 26rem);
    overflow-y: auto;
    padding: 0.875rem 1rem;
}

.global-search-suggestion {
    padding: 0.75rem 1rem;
    border-left: 0;
    border-right: 0;
}

.global-search-suggestion:first-child {
    border-top: 0;
}

.global-search-command {
    padding: 0.75rem 1rem;
    border-left: 0;
    border-right: 0;
    border-top: 1px solid #e3e8f0;
    color: #1f2c40;
    text-align: left;
    background: #fff;
}

.global-search-command:hover,
.global-search-command:focus {
    background: #f6f8fb;
}

.global-search-recent {
    padding: 0.65rem 0;
    color: #1f2c40;
    border-right: 0;
    border-left: 0;
    background: transparent;
    text-align: left;
}

.global-search-recent:hover,
.global-search-recent:focus-visible {
    color: #3730a3;
    background: #f7f6ff;
}

.global-search-clear-recents {
    padding: 0;
    color: #4f46c9;
    border: 0;
    background: transparent;
    font: inherit;
    font-size: 0.8125rem;
    font-weight: 700;
    text-decoration: underline;
}

.global-search-all-results {
    color: #4f46c9;
    background: #fafaff;
}

.global-search-all-results:hover,
.global-search-all-results:focus-visible {
    color: #3730a3;
    background: #f1f0ff;
}

.global-search-results {
    display: grid;
    gap: 0.75rem;
}

.global-search-result-group {
    margin: 1.25rem 0 0.1rem;
    color: #596579;
    font-size: 0.8125rem;
    font-weight: 700;
    letter-spacing: 0.035em;
    text-transform: uppercase;
}

.global-search-result-group:first-child {
    margin-top: 0;
}

.global-search-result-card {
    padding: 1rem;
    border: 1px solid #dfe5ed;
    border-radius: 0.625rem;
    background: #fff;
    box-shadow: 0 0.125rem 0.3rem rgba(31, 44, 64, 0.04);
}

.global-search-result-card:hover {
    border-color: #b7c3ee;
    box-shadow: 0 0.35rem 1.1rem rgba(50, 61, 101, 0.1);
}

.global-search-result-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.4rem;
}

.global-search-result-meta > span + span::before {
    margin-right: 0.4rem;
    color: #a1aabd;
    content: '•';
}

.global-search-result-type {
    display: inline-flex;
    align-items: center;
    padding: 0.1rem 0.4rem;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 700;
}

.global-search-result-type-project {
    color: #315d9c;
    background: #eaf3ff;
}

.global-search-result-type-work_item {
    color: #6c4f17;
    background: #fff4d8;
}

.global-search-result-type-discussion {
    color: #5c438c;
    background: #f0eaff;
}

.global-search-result-title {
    color: #1f2c40;
    font-size: 1.03rem;
    font-weight: 700;
    text-decoration: none;
}

.global-search-result-title:hover,
.global-search-result-title:focus-visible {
    color: #4f46c9;
    text-decoration: underline;
}

.global-search-result-reference {
    color: #4f46c9;
    font-size: 0.88em;
}

.global-search-result-excerpt,
.global-search-suggestion-excerpt {
    color: #596579;
    line-height: 1.5;
}

.global-search-result-card mark,
.global-search-suggestion mark {
    padding: 0.02em 0.14em;
    color: inherit;
    border-radius: 0.18rem;
    background: #fff0a6;
}

/* A reference or title match can land mid-word - `GAP` inside `GAP-1` - and inline
   padding on that mark pushed the rest of the word away, so the reference appeared to
   break in half (BACKENDUP-424). Excerpts keep the padding above: there a match is
   always a whole word, and the space around it is what makes the highlight readable. */
.global-search-result-title mark,
.global-search-suggestion-heading mark {
    padding: 0;
    border-radius: 0;
}

.global-search-dialog-footer {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 0.5rem;
    padding: 0.625rem 1rem;
    color: #657287;
    border-top: 1px solid #e5e9ef;
    background: #f8f9fb;
    font-size: 0.8125rem;
}

.global-search-dialog-footer kbd {
    color: #4c5870;
    background: #e7ebf0;
}

.global-search-toast {
    position: fixed;
    z-index: 1070;
    right: 1rem;
    bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    max-width: calc(100% - 2rem);
    padding: 0.75rem 0.875rem;
    color: #fff;
    border-radius: 0.5rem;
    background: #273247;
    box-shadow: 0 0.75rem 2rem rgba(0, 0, 0, 0.2);
    font-size: 0.875rem;
}

.global-search-toast button {
    padding: 0;
    color: #b9c8ff;
    border: 0;
    background: transparent;
    font: inherit;
    font-weight: 600;
    text-decoration: underline;
}

body.global-search-open {
    overflow: hidden;
}

/* Forms */
.form-control:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 0.2rem rgba(102, 126, 234, 0.25);
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
}

.btn-primary:hover {
    background: linear-gradient(135deg, #5a6fd8 0%, #6a4190 100%);
    transform: translateY(-1px);
}

/* Alerts */
.alert {
    border: none;
    border-radius: 8px;
}

/* Footer */
footer {
    margin-top: auto;
}

/* Utility Classes */
.text-gradient {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Responsive */
@media (max-width: 768px) {
    .hero-section {
        padding: 60px 0;
    }

    .hero-section h1 {
        font-size: 2.5rem;
    }

    .global-search-navigation {
        display: none;
    }

    .global-search-compact-trigger {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        margin-right: 0.5rem;
    }

    .global-search-overlay {
        align-items: start;
        padding: 0.75rem;
    }

    .global-search-dialog {
        max-height: calc(100vh - 1.5rem);
        max-height: calc(100dvh - 1.5rem);
    }

    .global-search-dialog-header {
        gap: 0.5rem;
        padding: 0.625rem 0.75rem;
    }

    .global-search-dialog-body {
        max-height: none;
    }

    .global-search-dialog-footer {
        align-items: start;
        flex-direction: column;
    }

    .global-search-filter-grid {
        grid-template-columns: minmax(0, 1fr);
    }

    .global-search-overlay-scope {
        min-width: 0;
        flex: 1 1 auto;
    }
}

/* Form error styling */
.invalid-feedback {
    display: block;
}

.alert-danger {
    border: none;
    border-radius: 8px;
    background-color: #f8d7da;
    color: #721c24;
}

.form-control.is-invalid {
    border-color: #dc3545;
    box-shadow: 0 0 0 0.2rem rgba(220, 53, 69, 0.25);
}

/* Profile avatar upload stays usable when the account card is narrow. */
.profile-avatar-upload {
    align-items: center;
    display: grid;
    gap: 1rem;
    grid-template-columns: auto minmax(0, 1fr);
}

.profile-avatar-controls {
    min-width: 0;
    overflow-wrap: anywhere;
}

.profile-avatar-controls a {
    overflow-wrap: anywhere;
    word-break: break-word;
}

.profile-avatar-controls input[type='file'] {
    max-width: 100%;
    width: 100%;
}

@media (max-width: 420px) {
    .profile-avatar-upload {
        grid-template-columns: minmax(0, 1fr);
    }

    .profile-avatar-upload > :first-child {
        justify-self: start;
    }
}

/* Focus states for better accessibility */
.form-control:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 0.2rem rgba(102, 126, 234, 0.25);
}

/* Images embedded in project descriptions stay within the text column */
.project-description img {
    max-width: 100%;
    height: auto;
}

/* CommonMark inline and fenced code in project/work-item descriptions. */
.project-description pre {
    overflow-x: auto;
    margin: 0 0 1rem;
    padding: 0.75rem 0.875rem;
    border-radius: 0.5rem;
    background: #0f172a;
    color: #e2e8f0;
}

.project-description code {
    padding: 0.08rem 0.25rem;
    border-radius: 0.2rem;
    background: #eef2ff;
    color: #3730a3;
}

.project-description pre code {
    padding: 0;
    background: transparent;
    color: inherit;
}

/* CommonMark block quotes in project/work-item descriptions. Bootstrap's
   reboot strips the browser indent, so without this a quoted excerpt was
   visually identical to a plain paragraph. */
.project-description blockquote {
    border-left: 0.22rem solid #8b8de7;
    background: #f8fafc;
    color: #475569;
    margin: 0 0 1rem;
    padding: 0.5rem 0.875rem;
}

.project-description blockquote p:last-child {
    margin-bottom: 0;
}

.project-description ul ul,
.project-description ul ol,
.project-description ol ul,
.project-description ol ol {
    margin-bottom: 0.3rem;
    margin-top: 0.3rem;
    padding-left: 1.4rem;
}

.project-description ul ul {
    list-style-type: circle;
}

.project-description ul ul ul {
    list-style-type: square;
}

/* GFM pipe tables in project/work-item descriptions (BACKENDUP-538).
   Mirrors the discussion-table recipe from BACKENDUP-496: with the automatic
   layout the browser happily shrinks a short column - the `id` column of a
   test plan, say - to its minimum once the preferred widths exceed the text
   column, so `A-1` breaks after the hyphen. The cell floor keeps every
   column readable, and the block/overflow pair lets a genuinely wide table
   scroll inside the description instead of breaking out of it. */
.project-description table {
    display: block;
    width: 100%;
    max-width: 100%;
    margin: 0 0 1rem;
    overflow-x: auto;
    border-collapse: collapse;
}

.project-description th,
.project-description td {
    border: 1px solid #dee2e6;
    min-width: 5rem;
    padding: 0.5rem 0.75rem;
    vertical-align: top;
}

.project-description thead th {
    background: #f8fafc;
    font-weight: 600;
}

/* Inline image previews inside the EasyMDE description editor */
.cm-inline-image {
    display: inline-block;
    max-width: 100%;
}

.cm-inline-image img {
    display: block;
    max-width: 100%;
    max-height: 20rem;
    margin: 0.25rem 0;
    border: 1px solid #dee2e6;
    border-radius: 0.375rem;
    cursor: pointer;
}

/* ===== Landing page (index) ===== */
.hero-home {
    padding: 88px 0 96px;
}

.hero-eyebrow {
    text-transform: uppercase;
    letter-spacing: 0.18em;
    font-size: 0.85rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.78);
    margin-bottom: 0.75rem;
}

.hero-headline {
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.25);
}

.hero-headline-accent {
    background: linear-gradient(90deg, #ffd86b 0%, #ff8f70 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    color: transparent;
}

.hero-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.hero-chip {
    display: inline-block;
    padding: 0.35rem 0.9rem;
    border-radius: 999px;
    font-size: 0.85rem;
    color: #fff;
    background: rgba(255, 255, 255, 0.14);
    border: 1px solid rgba(255, 255, 255, 0.28);
    backdrop-filter: blur(4px);
}

.hero-browser {
    background: #fff;
    border-radius: 14px;
    overflow: hidden;
    transform: perspective(1600px) rotateY(-4deg) rotateX(2deg);
    transition: transform 0.35s ease;
}

.hero-browser:hover {
    transform: perspective(1600px) rotateY(0deg) rotateX(0deg);
}

.hero-browser-bar,
.terminal-bar {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.6rem 0.9rem;
    background: #1f2430;
}

.hero-browser-dot {
    width: 11px;
    height: 11px;
    border-radius: 50%;
    display: inline-block;
    flex: 0 0 auto;
}

.hero-browser-title,
.terminal-title {
    margin-left: 0.6rem;
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.72);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.hero-browser-shot {
    display: block;
    width: 100%;
    height: auto;
}

.section-lead {
    max-width: 680px;
}

.split-card {
    border-radius: 16px;
    box-shadow: 0 10px 30px rgba(31, 41, 55, 0.08);
}

.split-badge {
    display: inline-block;
    padding: 0.25rem 0.8rem;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #fff;
}

.split-badge-work {
    background: #4f6ef7;
}

.split-badge-chat {
    background: #7c3aed;
}

.check-list {
    list-style: none;
    padding-left: 0;
}

.check-list li {
    position: relative;
    padding-left: 1.9rem;
    margin-bottom: 0.8rem;
    color: #3f4a5f;
}

.check-list li::before {
    content: '\2713';
    position: absolute;
    left: 0;
    top: 0;
    width: 1.35rem;
    height: 1.35rem;
    border-radius: 50%;
    background: #e6ecff;
    color: #4f6ef7;
    font-weight: 700;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.bridge-card {
    border-radius: 16px;
    background: linear-gradient(135deg, #f4f7ff 0%, #fdf3ff 100%);
    overflow: hidden;
}

.bridge-shot-wrap {
    padding: 1.5rem 1.5rem 1.5rem 0.5rem;
}

.bridge-shot {
    display: block;
    width: 100%;
    height: auto;
    border-radius: 12px;
    border: 1px solid rgba(79, 110, 247, 0.25);
    box-shadow: 0 14px 34px rgba(31, 41, 55, 0.16);
}

.ai-band {
    background: linear-gradient(135deg, #141a2e 0%, #241a3a 55%, #141a2e 100%);
    color: rgba(255, 255, 255, 0.88);
}

.ai-lead {
    color: rgba(255, 255, 255, 0.72);
}

.ai-list {
    list-style: none;
    padding-left: 0;
}

.ai-list li {
    position: relative;
    padding-left: 2rem;
    margin-bottom: 1.1rem;
    color: rgba(255, 255, 255, 0.82);
}

.ai-list li strong {
    color: #fff;
}

.ai-list li::before {
    content: '\26A1';
    position: absolute;
    left: 0;
    top: 0.05rem;
    font-size: 1rem;
}

.terminal {
    background: #0b1021;
    border-radius: 14px;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.12);
}

.terminal-body {
    margin: 0;
    padding: 1.1rem 1.25rem 1.3rem;
    color: #dbe4ff;
    font-size: 0.82rem;
    line-height: 1.55;
    overflow-x: auto;
    background: transparent;
}

.terminal-body code {
    color: inherit;
    white-space: pre;
}

.t-prompt {
    color: #7ee2a8;
    font-weight: 700;
}

.t-str {
    color: #ffd86b;
}

.t-key {
    color: #8ec5ff;
}

.t-url {
    color: #c9b8ff;
}

.t-ok {
    color: #7ee2a8;
    font-weight: 600;
}

.video-frame {
    border-radius: 16px;
    overflow: hidden;
    background: #000;
    border: 1px solid rgba(31, 41, 55, 0.15);
}

.video-frame video {
    display: block;
    width: 100%;
    height: auto;
}

.tour-shot {
    border-radius: 16px;
    overflow: hidden;
    background: #fff;
    border: 1px solid rgba(31, 41, 55, 0.08);
}

.tour-shot img {
    display: block;
    width: 100%;
    height: auto;
}

.tour-shot figcaption {
    padding: 1rem 1.25rem 1.25rem;
    color: #3f4a5f;
    font-size: 0.95rem;
}

.cta-band {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.cta-lead {
    color: rgba(255, 255, 255, 0.85);
    max-width: 640px;
    margin-left: auto;
    margin-right: auto;
}

@media (max-width: 991.98px) {
    .hero-browser {
        transform: none;
        margin-top: 2rem;
    }

    .bridge-shot-wrap {
        padding: 0 1.25rem 1.5rem;
    }
}

/* ===== Agent API docs page ===== */
.docs-hero {
    padding: 56px 0 72px;
}

.docs-hero-lead {
    max-width: 760px;
}

#quickstart .container {
    counter-reset: docs-step;
}

.docs-step {
    position: relative;
    background: #fff;
    border: 1px solid rgba(31, 41, 55, 0.08);
    border-radius: 14px;
    padding: 1.75rem 1.75rem 1.75rem 5rem;
    margin: 2.5rem 0;
    counter-increment: docs-step;
}

.docs-step > :last-child {
    margin-bottom: 0;
}

.docs-step .btn {
    margin-top: 0.5rem;
}

.docs-step::before {
    content: counter(docs-step);
    position: absolute;
    left: 1.5rem;
    top: 1.7rem;
    width: 2.1rem;
    height: 2.1rem;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
}

.docs-code {
    background: #0b1021;
    color: #dbe4ff;
    border-radius: 12px;
    border: 1px solid rgba(31, 41, 55, 0.25);
    padding: 1rem 1.25rem;
    font-size: 0.83rem;
    line-height: 1.6;
    overflow-x: auto;
}

.docs-code code {
    color: inherit;
    white-space: pre;
}

.docs-table-wrap {
    border: 1px solid rgba(31, 41, 55, 0.1);
    border-radius: 12px;
    background: #fff;
}

.docs-table {
    margin-bottom: 0;
}

.docs-table thead th {
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #6b7280;
    background: #f8fafc;
    border-bottom-width: 1px;
}

.docs-table td {
    font-size: 0.92rem;
    vertical-align: top;
}

.docs-method {
    font-family: SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 0.8rem;
    font-weight: 700;
    color: #4f6ef7;
    white-space: nowrap;
}

.docs-path code {
    font-size: 0.8rem;
    color: #2f3b52;
    word-break: break-all;
}

.terminal-note {
    margin-top: 0.9rem;
}

.terminal-note a {
    color: rgba(255, 255, 255, 0.72);
    text-decoration: underline dotted;
    font-size: 0.9rem;
}

.terminal-note a:hover {
    color: #fff;
}

@media (max-width: 575.98px) {
    .docs-step {
        padding-left: 1.5rem;
        padding-top: 4rem;
    }

    .docs-step::before {
        left: 1.5rem;
        top: 1.1rem;
    }
}

/* Triage priority chip. The owning row supplies --workflow-priority-color from
   the organization's configured priority, so one rule serves the board card,
   the backlog row, and anywhere else triage is shown. */
.workflow-priority-label {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    color: #4b5563;
    font-size: 0.6875rem;
    font-weight: 700;
    line-height: 1.4;
    white-space: nowrap;
}

.workflow-priority-label::before {
    width: 0.5rem;
    height: 0.5rem;
    border-radius: 50%;
    background: var(--workflow-priority-color, #64748b);
    content: '';
}

/* Organization tags. Unlike the priority chip these come as a set, so the row
   wraps them instead of spacing them; the colour arrives from each label the
   organization owns, and the border keeps a pale tag readable on a white card. */
.work-item-label-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
}

.work-item-label-chip {
    border: 1px solid color-mix(in srgb, var(--work-item-label-color, #64748b) 45%, transparent);
    border-radius: 999px;
    color: #374151;
    font-size: 0.6875rem;
    font-weight: 600;
    line-height: 1.4;
    padding: 0.05rem 0.45rem;
    white-space: nowrap;
}

.work-item-label-chip::before {
    background: var(--work-item-label-color, #64748b);
    border-radius: 50%;
    content: '';
    display: inline-block;
    height: 0.45rem;
    margin-right: 0.3rem;
    width: 0.45rem;
}

/* User guide (/docs/) - sidebar nav, glossary, section pager (BACKENDUP-569) */
.docs-sidebar {
    border-left: 1px solid var(--bs-border-color);
    padding-left: 1.25rem;
}
.docs-sidebar-brand {
    display: block;
    color: var(--bs-body-color);
    font-weight: 700;
    margin-bottom: 0.5rem;
    text-decoration: none;
}
.docs-sidebar .docs-nav-link {
    display: block;
    padding: 0.25rem 0;
    color: var(--bs-body-color);
    font-size: 0.925rem;
    text-decoration: none;
}
.docs-sidebar .docs-nav-link:hover {
    color: var(--bs-primary);
}
.docs-sidebar .docs-nav-link.active {
    color: var(--bs-primary);
    font-weight: 600;
}
.docs-glossary dt {
    font-weight: 600;
    margin-top: 0.75rem;
}
.docs-glossary dd {
    color: var(--bs-secondary-color);
    margin-bottom: 0;
}
/* The guide's numbered steps reuse the API page's .docs-step card and counter
   bubble (above); this only scopes the counter to the guide's own list so the
   two pages never depend on each other's reset. */
.docs-steps {
    counter-reset: docs-step;
}
.docs-anchor-link {
    margin-left: 0.45rem;
    color: var(--bs-secondary-color);
    font-size: 0.85em;
    font-weight: 400;
    opacity: 0.4;
    text-decoration: none;
}
.docs-anchor-link:hover,
.docs-anchor-link:focus-visible {
    color: var(--bs-primary);
    opacity: 1;
}


/* =============================================================================
   BACKENDUP-352: dark mode.

   The light rules above stay byte-identical. Everything below keys off the
   concrete data-bs-theme that base.html's head script resolves (explicit stored
   choice, else the operating system), and borrows Bootstrap's own dark palette:
   body #212529, tertiary #2b3035, secondary #343a40, lines #495057, body ink
   #dee2e6. Tinted chips become translucent accent washes so they survive any
   surface. BACKENDUP-429's light link/ink contrast work is not copied here -
   Bootstrap's dark emphasis blues are its readable counterpart on the dark
   canvas - and the e2e contrast audit (core/e2e.py assert_readable) runs the
   dark surfaces too, so regressions here fail the build the same way.
   ============================================================================= */
html[data-bs-theme="dark"] {
    --bs-link-color: #6ea8fe;
    --bs-link-color-rgb: 110, 168, 254;
    --bs-link-hover-color: #8ec2fe;
    --bs-link-hover-color-rgb: 142, 194, 254;
    --bs-primary: #6ea8fe;
    --bs-primary-rgb: 110, 168, 254;
}

html[data-bs-theme="dark"] body {
    color: var(--bs-body-color);
}

html[data-bs-theme="dark"] .btn-outline-secondary {
    /* BACKENDUP-696, the same audit BACKENDUP-429 ran on the light canvas, on the dark one:
       --bs-secondary-color resolves through Bootstrap's own color-mix to a translucent slate
       that Chrome measured at rgba(96,106,121,0.976) on rgb(33,37,41) - 2.75:1 for the
       'Dashboard' button ink, body-size text under a 4.5:1 floor. Pin the button's own token
       to an opaque grey that clears the floor with margin (7.5:1) on every engine, exactly
       the move 429 made with #556070 for the light theme. */
    --bs-btn-color: #adb5bd;
    --bs-btn-hover-bg: var(--bs-secondary-bg);
    --bs-btn-hover-border-color: var(--bs-secondary-bg);
    --bs-btn-hover-color: var(--bs-emphasis-color);
}

/* The nav tokens resolve from component-level defaults, so overriding --bs-link-color alone
   left the inactive 'Projects' / 'Mentions' / 'Recent' / 'Worked on' inks at rgb(20,96,207)
   on rgb(33,37,41) - 2.65:1, the same borderline story one layer down. Pin the nav's own
   tokens to the dark primary this block already declares: 6.4:1, with the hover one shade
   up. Scoped to the dark theme; every light rule stays byte-identical (BACKENDUP-352's
   contract, which the login/backlog/detail contrast audits keep honest). */
html[data-bs-theme="dark"] .nav {
    --bs-nav-link-color: #6ea8fe;
    --bs-nav-link-hover-color: #8ec2fe;
}

/* The theme control rides the always-dark navbar strip in both themes. */
.navbar-theme-toggle {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.25rem 0.75rem;
    font-size: 1.05rem;
    line-height: 1;
    color: #dfe5ed;
    white-space: nowrap;
}

.navbar-theme-toggle:hover,
.navbar-theme-toggle:focus-visible {
    color: #fff;
}

.navbar-theme-toggle:focus-visible {
    outline: 2px solid #8b8cf8;
    outline-offset: 2px;
    border-radius: 0.35rem;
}

.navbar-theme-toggle-label {
    font-size: 0.9rem;
}

/* --- global search dialog --- */
html[data-bs-theme="dark"] .global-search-dialog { background: var(--bs-body-bg); border-color: var(--bs-border-color); }
html[data-bs-theme="dark"] .global-search-dialog-header { border-bottom-color: var(--bs-border-color); }
html[data-bs-theme="dark"] .global-search-dialog-header .global-search-icon { color: var(--bs-secondary-color); }
html[data-bs-theme="dark"] .global-search-input { color: var(--bs-body-color); }
html[data-bs-theme="dark"] .global-search-close { color: var(--bs-secondary-color); }
html[data-bs-theme="dark"] .global-search-close:focus-visible { color: var(--bs-body-color); background: var(--bs-tertiary-bg); }
html[data-bs-theme="dark"] .global-search-filter-panel { border-top-color: var(--bs-border-color); background: var(--bs-tertiary-bg); }
html[data-bs-theme="dark"] .global-search-filter-panel .backlog-filter-multiselect-toggle { background: var(--bs-secondary-bg); border-color: var(--bs-border-color); color: var(--bs-body-color); }
html[data-bs-theme="dark"] .global-search-filter-panel .backlog-filter-multiselect-toggle:disabled { color: var(--bs-tertiary-color); background: var(--bs-secondary-bg); }
html[data-bs-theme="dark"] .global-search-filter-toggle { color: #a5b4fc; border-color: rgba(165, 180, 252, 0.35); background: rgba(165, 180, 252, 0.12); }
html[data-bs-theme="dark"] .global-search-filter-toggle:focus-visible { color: #c7d2fe; border-color: rgba(165, 180, 252, 0.55); background: rgba(165, 180, 252, 0.2); }
html[data-bs-theme="dark"] .global-search-filter-grid > .backlog-filter-multiselect { color: var(--bs-secondary-color); }
html[data-bs-theme="dark"] .global-search-filter-panel .backlog-filter-checkbox { color: var(--bs-body-color); }
html[data-bs-theme="dark"] .global-search-filter-actions { color: var(--bs-secondary-color); }
html[data-bs-theme="dark"] .global-search-filter-actions button { color: #a5b4fc; }
html[data-bs-theme="dark"] .global-search-command { border-top-color: var(--bs-border-color); color: var(--bs-body-color); background: var(--bs-body-bg); }
html[data-bs-theme="dark"] .global-search-command:focus { background: var(--bs-tertiary-bg); }
html[data-bs-theme="dark"] .global-search-recent { color: var(--bs-body-color); }
html[data-bs-theme="dark"] .global-search-recent:focus-visible { color: #c7d2fe; background: rgba(165, 180, 252, 0.12); }
html[data-bs-theme="dark"] .global-search-clear-recents,
html[data-bs-theme="dark"] .global-search-all-results { color: #a5b4fc; }
html[data-bs-theme="dark"] .global-search-all-results { background: rgba(165, 180, 252, 0.08); }
html[data-bs-theme="dark"] .global-search-all-results:focus-visible { color: #c7d2fe; background: rgba(165, 180, 252, 0.18); }
html[data-bs-theme="dark"] .global-search-result-group { color: var(--bs-secondary-color); }
html[data-bs-theme="dark"] .global-search-result-card { border-color: var(--bs-border-color); background: var(--bs-tertiary-bg); }
html[data-bs-theme="dark"] .global-search-result-card:hover { border-color: rgba(165, 180, 252, 0.55); }
html[data-bs-theme="dark"] .global-search-result-meta > span + span::before { color: var(--bs-tertiary-color); }
html[data-bs-theme="dark"] .global-search-result-type-project { color: #93c5fd; background: rgba(59, 130, 246, 0.16); }
html[data-bs-theme="dark"] .global-search-result-type-work_item { color: #fbbf24; background: rgba(245, 158, 11, 0.16); }
html[data-bs-theme="dark"] .global-search-result-type-discussion { color: #c4b5fd; background: rgba(139, 92, 246, 0.16); }
html[data-bs-theme="dark"] .global-search-result-title { color: var(--bs-body-color); }
html[data-bs-theme="dark"] .global-search-result-title:focus-visible { color: #a5b4fc; }
html[data-bs-theme="dark"] .global-search-result-reference { color: #a5b4fc; }
html[data-bs-theme="dark"] .global-search-suggestion-excerpt { color: var(--bs-secondary-color); }
/* BACKENDUP-844: the mark rule already covered the overlay suggestion half, but
   not the results page - the same theme-blind story is the literal
   #fff0a6 the light rule paints (a deliberate deeper yellow: Bootstrap itself uses
   #fff3cd, so the light literal stays). The dark half is the pair it already ships -
   #facc15 with #211d05 ink, 11.0:1 - now owning both surfaces. And the excerpt ink
   join: the light rule pairs .global-search-result-excerpt with the suggestion side,
   the dark flip only named the suggestion half (the 842 shape) - #596579 on the dark
   card would measure 2.26:1 the moment any result carries a description. */
html[data-bs-theme="dark"] .global-search-suggestion mark,
html[data-bs-theme="dark"] .global-search-result-card mark { background: #facc15; color: #211d05; }
html[data-bs-theme="dark"] .global-search-result-excerpt { color: var(--bs-secondary-color); }
html[data-bs-theme="dark"] .global-search-dialog-footer { color: var(--bs-secondary-color); border-top-color: var(--bs-border-color); background: var(--bs-tertiary-bg); }
html[data-bs-theme="dark"] .global-search-dialog-footer kbd { background: var(--bs-body-bg); color: var(--bs-body-color); }

/* --- alerts / validation --- */
html[data-bs-theme="dark"] .alert-danger {
    background-color: var(--bs-danger-bg-subtle);
    border-color: var(--bs-danger-border-subtle);
    color: var(--bs-danger-text-emphasis);
}

/* --- rendered markdown (project description, shared markup family) --- */
html[data-bs-theme="dark"] .project-description code { background: rgba(165, 180, 252, 0.14); color: #b8bcfd; }
html[data-bs-theme="dark"] .project-description blockquote { background: var(--bs-tertiary-bg); border-left-color: #8b8cf8; color: var(--bs-secondary-color); }
html[data-bs-theme="dark"] .project-description td { border-color: var(--bs-border-color); }
html[data-bs-theme="dark"] .project-description thead th { background: var(--bs-tertiary-bg); }
html[data-bs-theme="dark"] .cm-inline-image img { border-color: var(--bs-border-color); }

/* --- landing & docs surfaces that sit directly on the page --- */
html[data-bs-theme="dark"] .check-list li { color: var(--bs-body-color); }
html[data-bs-theme="dark"] .check-list li::before { background: rgba(79, 110, 247, 0.22); color: #a5b4fc; }
html[data-bs-theme="dark"] .bridge-card { background: linear-gradient(135deg, #1f2633 0%, #241a3a 100%); }
html[data-bs-theme="dark"] .docs-step { background: var(--bs-tertiary-bg); }
html[data-bs-theme="dark"] .docs-table-wrap { background: var(--bs-tertiary-bg); }
html[data-bs-theme="dark"] .docs-table thead th { color: var(--bs-secondary-color); background: var(--bs-secondary-bg); }
html[data-bs-theme="dark"] .docs-method { color: #8ea4fd; }
html[data-bs-theme="dark"] .docs-path code { color: #cbd5e1; }

/* --- triage chips --- */
html[data-bs-theme="dark"] .workflow-priority-label { color: var(--bs-body-color); }
html[data-bs-theme="dark"] .work-item-label-chip { color: var(--bs-body-color); }

html[data-bs-theme="dark"] .global-search-overlay-scope,
html[data-bs-theme="dark"] .global-search-filter-panel select,
html[data-bs-theme="dark"] .global-search-filter-panel input:not([type='checkbox']):not([type='radio']) {
    background: var(--bs-secondary-bg);
    border-color: var(--bs-border-color);
    color: var(--bs-body-color);
}

/* --- BACKENDUP-753: the EasyMDE description editor (pinned 2.18.0 by
   projects/includes/easymde_assets.html, mounted by project_form.js on all four
   description surfaces). The widget replaces the textarea with its own DOM and the
   CDN stylesheet hard-codes light surfaces - a white CodeMirror canvas, #ced4da
   borders, #fafafa preview, #f9f9f9 heading dropdown - which is exactly the white
   field the item reports. Toolbar glyphs inherit the page ink and flip on their
   own; these rules move only the surfaces, the caret, the selection, and the two
   token colours that would vanish on the dark canvas. */
html[data-bs-theme="dark"] .EasyMDEContainer .CodeMirror {
    background: var(--bs-body-bg);
    border-color: var(--bs-border-color);
    color: var(--bs-body-color);
}

html[data-bs-theme="dark"] .EasyMDEContainer .CodeMirror-fullscreen { background: var(--bs-body-bg); }
html[data-bs-theme="dark"] .CodeMirror-scrollbar-filler,
html[data-bs-theme="dark"] .CodeMirror-gutter-filler { background-color: var(--bs-body-bg); }
html[data-bs-theme="dark"] .CodeMirror-cursor { border-left-color: var(--bs-body-color); }
html[data-bs-theme="dark"] .CodeMirror-selected,
html[data-bs-theme="dark"] .EasyMDEContainer .CodeMirror-focused .CodeMirror-selected { background: rgba(110, 168, 254, 0.28); }
html[data-bs-theme="dark"] .CodeMirror-line::selection,
html[data-bs-theme="dark"] .CodeMirror-line > span::selection,
html[data-bs-theme="dark"] .CodeMirror-line > span > span::selection { background: rgba(110, 168, 254, 0.28); }
/* The UA paints toolbar buttons with its own `buttontext`, which follows the operating
   system's palette rather than the page theme - invisible on a light-OS machine running
   the app dark. Declare the scheme (Bootstrap's documented companion to data-bs-theme;
   it also darkens native scrollbars, carets and form autofill) and pin the ink itself. */
html[data-bs-theme="light"] { color-scheme: light; }
html[data-bs-theme="dark"] { color-scheme: dark; }
html[data-bs-theme="dark"] .editor-toolbar { border-color: var(--bs-border-color); }
html[data-bs-theme="dark"] .editor-toolbar button { color: var(--bs-body-color); }
html[data-bs-theme="dark"] .editor-toolbar button.active,
html[data-bs-theme="dark"] .editor-toolbar button:hover { background: var(--bs-secondary-bg); border-color: var(--bs-secondary-color); }
html[data-bs-theme="dark"] .editor-toolbar i.separator { border-left-color: var(--bs-border-color); border-right-color: transparent; }
html[data-bs-theme="dark"] .editor-toolbar.fullscreen { background: var(--bs-body-bg); }
html[data-bs-theme="dark"] .editor-toolbar.fullscreen::before,
html[data-bs-theme="dark"] .editor-toolbar.fullscreen::after { display: none; }
html[data-bs-theme="dark"] .editor-toolbar .easymde-dropdown,
html[data-bs-theme="dark"] .editor-toolbar .easymde-dropdown:hover {
    background: linear-gradient(to bottom right, var(--bs-secondary-bg) 0, var(--bs-secondary-bg) 84%, var(--bs-body-color) 50%, var(--bs-body-color) 100%);
    border-color: var(--bs-secondary-bg);
}
html[data-bs-theme="dark"] .easymde-dropdown-content { background-color: var(--bs-secondary-bg); }
html[data-bs-theme="dark"] .editor-preview { background: var(--bs-tertiary-bg); }
html[data-bs-theme="dark"] .editor-preview pre { background: var(--bs-secondary-bg); }
html[data-bs-theme="dark"] .editor-preview-side { border-color: var(--bs-border-color); }
html[data-bs-theme="dark"] .editor-preview table td,
html[data-bs-theme="dark"] .editor-preview table th { border-color: var(--bs-border-color); }
html[data-bs-theme="dark"] .cm-s-easymde .cm-comment { background: rgba(255, 255, 255, 0.1); }
html[data-bs-theme="dark"] .cm-s-easymde .cm-string { color: #93c5fd; }
html[data-bs-theme="dark"] .cm-s-easymde .cm-attribute { color: #c4b5fd; }
html[data-bs-theme="dark"] .cm-s-easymde .cm-tag { color: #7ee787; }

/* --- BACKENDUP-754: Bootstrap's .btn-light is the one variant that never reads the
   theme - its tokens hard-code #f8f9fa surfaces and #000 ink instead of the
   subtle/emphasis families - so every white chip stayed bright on the dark canvas.
   The item names the comment toolbar, whose 53 uses live in the discussion app; one
   flip here owns the class everywhere (composer and edit toolbars, workspace panes,
   the login Google button, api docs CTA). The marketing bands are the deliberate
   exception: the hero and the closing CTA are dark artwork in BOTH themes, and their
   white buttons are the composition, not an oversight. */
html[data-bs-theme="dark"] .btn-light {
    --bs-btn-color: var(--bs-emphasis-color);
    --bs-btn-bg: var(--bs-secondary-bg);
    --bs-btn-border-color: var(--bs-secondary-bg);
    --bs-btn-hover-color: var(--bs-emphasis-color);
    --bs-btn-hover-bg: #414a54;
    --bs-btn-hover-border-color: #414a54;
    --bs-btn-focus-shadow-rgb: 82, 88, 95;
    --bs-btn-active-color: var(--bs-emphasis-color);
    --bs-btn-active-bg: #4b5563;
    --bs-btn-active-border-color: #454d57;
    --bs-btn-disabled-color: var(--bs-tertiary-color);
    --bs-btn-disabled-bg: var(--bs-secondary-bg);
    --bs-btn-disabled-border-color: var(--bs-secondary-bg);
}

html[data-bs-theme="dark"] .hero-section .btn-light,
html[data-bs-theme="dark"] .cta-band .btn-light {
    --bs-btn-color: #000;
    --bs-btn-bg: #f8f9fa;
    --bs-btn-border-color: #f8f9fa;
    --bs-btn-hover-color: #000;
    --bs-btn-hover-bg: #d3d4d5;
    --bs-btn-hover-border-color: #c6c7c8;
    --bs-btn-active-color: #000;
    --bs-btn-active-bg: #c6c7c8;
    --bs-btn-active-border-color: #babbbc;
    --bs-btn-disabled-color: #000;
    --bs-btn-disabled-bg: #f8f9fa;
    --bs-btn-disabled-border-color: #f8f9fa;
}

/* --- BACKENDUP-838: the other half of the 754 story. Bootstrap's `.bg-light`
   utility reads `--bs-light-rgb`, a triplet the dark theme never redefines, so
   every surface borrowing it stayed #f8f9fa under inks that had already moved
   to the dark palette - the organization page's Projects and Team details card
   headers, its status-group panels (the item's screenshot), and the count
   chips app-wide. The light theme already equates bg-light with
   `--bs-tertiary-bg` (#f8f9fa), so the flip is one token: the utility learns
   to read the theme it was skipping. The chips that pin a theme-blind ink
   beside it (`text-dark`, `text-secondary` - the same triplet story 832 told
   about `text-secondary`) ride the body and muted inks, and `.text-bg-light`,
   which hard-codes #000, owns both halves the way 754 did for `.btn-light`.
   No marketing exception here: the bands that stay white in dark are
   `btn-light` CTAs on artwork, not `bg-light` surfaces. */
html[data-bs-theme="dark"] .bg-light {
    background-color: var(--bs-tertiary-bg) !important;
}

html[data-bs-theme="dark"] .bg-light.text-dark {
    color: var(--bs-body-color) !important;
}

html[data-bs-theme="dark"] .bg-light.text-secondary {
    color: var(--bs-secondary-color) !important;
}

html[data-bs-theme="dark"] .text-bg-light {
    color: var(--bs-body-color) !important;
    background-color: var(--bs-tertiary-bg) !important;
}

/* BACKENDUP-842: the danger red joins the same theme-blind family. `.text-danger` reads
   `--bs-danger-rgb` and `.btn-outline-danger` hard-codes #dc3545 - neither is redefined
   by the dark theme - so every "Delete", "Revoke", "Archive" and form-error line sat at
   3.36:1 on the dark canvas (measured on the workspace rail and conversation header;
   the org pages carry the same ink). Bootstrap already ships the readable counterpart
   as its own token: `--bs-danger-text-emphasis` (#ea868f, 6.0:1 on #21262d). One flip
   owns the class everywhere; the hover fill stays Bootstrap's solid danger with white
   ink (4.53:1), so only the resting ink moves. */
html[data-bs-theme="dark"] .text-danger {
    color: var(--bs-danger-text-emphasis) !important;
}

html[data-bs-theme="dark"] .btn-outline-danger {
    --bs-btn-color: var(--bs-danger-text-emphasis);
    --bs-btn-border-color: var(--bs-danger-text-emphasis);
}

/* BACKENDUP-843: the floating panels - the conversation header's People popover and
   Webhooks disclosure (the item's measured surface, every ink inside it at 1.22-1.30:1),
   the emoji picker and the mention/reference panels - paint themselves with Bootstrap's
   `bg-white`, the theme-blind twin of 838's `bg-light`: `--bs-white-rgb` is never
   redefined, so they stayed pure white islands under theme-following ink. The dark
   counterpart is Bootstrap's own raised-menu surface - `--bs-body-bg`, what its
   dropdowns resolve to in dark - one flip owning the class everywhere. */
html[data-bs-theme="dark"] .bg-white {
    background-color: var(--bs-body-bg) !important;
}

/* ---------- Palette assistant (BACKENDUP-751) ---------- */
.global-search-tabs {
    display: flex;
    gap: 0.25rem;
    padding: 0.375rem 1rem 0;
    border-bottom: 1px solid var(--bs-border-color);
}

.global-search-tab {
    border: 0;
    background: none;
    padding: 0.375rem 0.625rem 0.5rem;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--bs-secondary-color);
    border-bottom: 2px solid transparent;
    cursor: pointer;
}

.global-search-tab.is-active {
    color: var(--bs-body-color);
    border-bottom-color: var(--bs-primary-color, #0d6efd);
}

/* The search box and its tools belong to the Search tab only. */
.global-search-dialog.assistant-active .global-search-input,
.global-search-dialog.assistant-active .global-search-overlay-tools {
    display: none;
}

.global-search-assistant {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    max-height: min(52vh, 30rem);
}

.global-search-assistant-transcript {
    flex: 1 1 auto;
    min-height: 6rem;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.global-search-assistant-turn.user {
    align-self: flex-end;
    max-width: 85%;
    background: var(--bs-tertiary-bg);
    border-radius: 0.6rem;
    padding: 0.4rem 0.65rem;
}

.global-search-assistant-turn.assistant {
    align-self: stretch;
}

.global-search-assistant-turn.is-refusal,
.global-search-assistant-turn.is-error {
    border: 1px solid var(--bs-border-color);
    border-left: 3px solid var(--bs-warning-border-subtle, #ffc107);
    border-radius: 0.5rem;
    padding: 0.5rem 0.7rem;
    font-size: 0.9rem;
}

.global-search-assistant-turn.is-error {
    border-left-color: var(--bs-danger-border-subtle, #dc3545);
}

.global-search-assistant-turn.is-streaming::after {
    content: '\258c';
    animation: assistant-caret 1s steps(2) infinite;
}

@keyframes assistant-caret {
    50% { opacity: 0; }
}

.global-search-assistant-line {
    overflow-wrap: anywhere;
}

.global-search-assistant-list {
    margin: 0 0 0.25rem;
    padding-left: 1.2rem;
}

.global-search-assistant-link {
    overflow-wrap: anywhere;
}

.global-search-assistant-sources {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    margin-top: 0.5rem;
}

.global-search-assistant-source {
    font-size: 0.75rem;
    line-height: 1.4;
    padding: 0.1rem 0.5rem;
    border: 1px solid var(--bs-border-color);
    border-radius: 999px;
    text-decoration: none;
    color: var(--bs-secondary-color);
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

a.global-search-assistant-source:hover {
    color: var(--bs-link-color);
    border-color: var(--bs-link-color);
}

/* Draft cards (BACKENDUP-776): pending asks, terminal tells. */
.global-search-assistant-draft {
    align-self: stretch;
    border: 1px solid var(--bs-border-color);
    border-left: 3px solid var(--bs-warning-border-subtle, #ffc107);
    border-radius: 0.5rem;
    padding: 0.55rem 0.7rem;
    font-size: 0.875rem;
    background: var(--bs-tertiary-bg);
}

.global-search-assistant-draft.is-executed {
    border-left-color: var(--bs-success-border-subtle, #75b798);
}

.global-search-assistant-draft.is-rejected,
.global-search-assistant-draft.is-failed {
    border-left-color: var(--bs-secondary-border-subtle, #6c757d);
    color: var(--bs-secondary-color);
}

.global-search-assistant-draft-badge {
    display: inline-block;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--bs-secondary-color);
    border: 1px solid var(--bs-border-color);
    border-radius: 0.35rem;
    padding: 0.05rem 0.35rem;
    vertical-align: 0.08rem;
}

.global-search-assistant-draft-fields {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 0.15rem 0.6rem;
    margin-top: 0.35rem;
}

.global-search-assistant-draft-fields dt {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--bs-secondary-color);
    text-align: right;
}

.global-search-assistant-draft-fields dd {
    margin: 0;
    overflow-wrap: anywhere;
    white-space: pre-wrap;
}

.global-search-assistant-draft-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.global-search-assistant-draft-note {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    flex-wrap: wrap;
    margin-top: 0.45rem;
    font-size: 0.8rem;
    color: var(--bs-secondary-color);
}

.global-search-assistant-draft-note.is-transport {
    color: var(--bs-danger-text-emphasis, #842029);
}

.global-search-assistant-draft .global-search-assistant-source {
    margin: 0;
}

.global-search-assistant-recent {
    border-top: 1px solid var(--bs-border-color);
    padding-top: 0.35rem;
    max-height: 8rem;
    overflow-y: auto;
}

.global-search-assistant-recent-row {
    display: block;
    width: 100%;
    text-align: start;
    border: 0;
    background: none;
    padding: 0.3rem 0.5rem;
    border-radius: 0.4rem;
    cursor: pointer;
}

.global-search-assistant-recent-row:hover {
    background: var(--bs-tertiary-bg);
}

.global-search-assistant-compose {
    display: flex;
    align-items: flex-end;
    gap: 0.4rem;
    border-top: 1px solid var(--bs-border-color);
    padding-top: 0.5rem;
    position: sticky;
    bottom: 0;
    background: inherit;
}

.global-search-assistant-input {
    flex: 1 1 auto;
    resize: none;
    border: 1px solid var(--bs-border-color);
    border-radius: 0.5rem;
    padding: 0.4rem 0.6rem;
    font-size: 0.9rem;
    background: var(--bs-body-bg);
    color: var(--bs-body-color);
}

.global-search-assistant-input:focus {
    outline: 2px solid var(--bs-primary-bg-subtle, rgba(13, 110, 253, 0.25));
    outline-offset: -1px;
}

.global-search-ask-ai::before {
    content: '\2728  ';
}
