/* The shared list (#423): links, toolbar, table, pager, and the job list's cards. */

/* ---------------------------------------------------------------------------
   Asset reachability (#227, #228)

   AssetLink is how one asset names another anywhere in the app: the kind's
   icon, then the name as a link. RelatedAssetsPanel groups those links under
   a heading with a count.
   --------------------------------------------------------------------------- */
.qcb-asset-link {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    min-width: 0;
    color: var(--qcb-gray-800);
    font-weight: 600;
    text-decoration: none;
}

/* Dark text that underlines on hover, as the job page's header (#381), rather than the
   green links these used to be. The kind's icon tile still marks them as links. */
.qcb-asset-link:hover {
    color: var(--qcb-gray-900);
}

.qcb-asset-link:hover .qcb-asset-link-name,
.qcb-asset-link:focus-visible .qcb-asset-link-name {
    text-decoration: underline;
    text-underline-offset: 3px;
}

.qcb-asset-link:focus-visible {
    outline: 2px solid var(--qcb-teal-600);
    outline-offset: 2px;
    border-radius: 4px;
}

.qcb-asset-link-name {
    overflow-wrap: anywhere;
}

.qcb-asset-link-icon {
    display: inline-grid;
    place-items: center;
    width: 1.375rem;
    height: 1.375rem;
    flex-shrink: 0;
    border-radius: 6px;
    font-size: 0.8125rem;
}

.qcb-asset-link-icon--other { background: var(--qcb-gray-100); color: var(--qcb-gray-600); }

/* A connection's logo (#606), through ConnectionLogo: the storage provider's artwork, or a
   cloud or server glyph for Qlik, on a small tile that stays light in both themes so
   GitHub's black mark can be seen. The type is the tile's tooltip. */
.qcb-conn-logo {
    display: inline-grid;
    place-items: center;
    width: 1.625rem;
    height: 1.625rem;
    flex-shrink: 0;
    border-radius: 6px;
    background: #ffffff;
    border: 1px solid var(--qcb-border);
    cursor: help;
}

.qcb-conn-logo img {
    width: 1.125rem;
    height: 1.125rem;
    object-fit: contain;
}

/* span.: card rows hide their own glyphs (ui.css), not this one. */
span.qcb-conn-logo > i {
    display: inline-block;
    width: auto;
    font-size: 0.9375rem;
    line-height: 1;
    color: var(--qcb-green-700);
}

.qcb-conn-logo--sm {
    width: 1.375rem;
    height: 1.375rem;
    border-radius: 5px;
}

.qcb-conn-logo--sm img {
    width: 0.875rem;
    height: 0.875rem;
}

span.qcb-conn-logo--sm > i {
    font-size: 0.8125rem;
}

.qcb-conn-name {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    min-width: 0;
}

.qcb-conn-name-text {
    overflow-wrap: anywhere;
}

/* The chosen project's connections, under the job editor's project choice. */
.qcb-project-conns {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.375rem 0.5rem;
}

/* The card rows already carry their own icon, so a link inside one drops its tile. */
.qcb-card-info-row .qcb-asset-link-icon {
    display: none;
}

/* Not a link (#229): a target that was deleted, or a page the viewer's role cannot
   open. Both keep the name readable and say why in words, not only in colour. */
.qcb-asset-link--deleted,
.qcb-asset-link--locked,
.qcb-asset-link--pending {
    color: var(--qcb-gray-600);
    font-weight: 500;
    cursor: default;
}

.qcb-asset-link--deleted .qcb-asset-link-name {
    text-decoration: line-through;
}

.qcb-asset-link--deleted .qcb-asset-link-icon,
.qcb-asset-link--locked .qcb-asset-link-icon {
    opacity: 0.6;
}

.qcb-asset-link-state {
    flex-shrink: 0;
    font-size: 0.75rem;
}

.qcb-asset-link-note {
    display: inline-flex;
    align-items: center;
    gap: 0.2rem;
    color: var(--qcb-gray-500);
    font-weight: 500;
}

/* The webhook coverage rows lead with the channel's own logo. */
.qcb-coverage-name .qcb-asset-link-icon {
    display: none;
}

/* A webhook's scope, by name (#230). */
.qcb-scope-summary {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.25rem 0.5rem;
    min-width: 0;
}

.qcb-scope-summary-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem 0.75rem;
    margin: 0;
    padding: 0;
    list-style: none;
}

.qcb-scope-summary-list .qcb-asset-link-icon {
    width: 1.125rem;
    height: 1.125rem;
    font-size: 0.6875rem;
}

.qcb-related {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.qcb-related-group-head {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    justify-content: space-between;
    gap: 0.25rem 1rem;
    margin-bottom: 0.5rem;
}

.qcb-related-group-title {
    margin: 0;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--qcb-gray-500);
}

.qcb-related-count {
    display: inline-block;
    margin-left: 0.25rem;
    font-variant-numeric: tabular-nums;
}

.qcb-related-group-links {
    display: flex;
    gap: 1rem;
    font-size: 0.8125rem;
}

.qcb-related-group-links a {
    color: var(--qcb-teal-700);
    font-weight: 600;
    text-decoration: none;
}

.qcb-related-group-links a:hover {
    text-decoration: underline;
}

.qcb-related-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
}

.qcb-related-item {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.25rem 1rem;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--qcb-gray-200);
    border-radius: 8px;
}

.qcb-related-meta {
    display: inline-flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.8125rem;
    color: var(--qcb-gray-500);
}

.qcb-related-empty,
.qcb-related-more {
    margin: 0;
    font-size: 0.8125rem;
    color: var(--qcb-gray-500);
}

.qcb-related-more {
    margin-top: 0.5rem;
}

/* Job counts under a project card. */
.qcb-card-counts {
    display: flex;
    flex-wrap: wrap;
    gap: 0.375rem;
    margin-bottom: 1rem;
}

.qcb-card-count {
    text-decoration: none;
}

.qcb-card-count:hover {
    text-decoration: underline;
}

.qcb-card-count--none {
    background: var(--qcb-gray-50);
    border-color: var(--qcb-gray-200);
    color: var(--qcb-gray-500);
}

/* ---- Lists (#423) ----------------------------------------------------------
   The one list: Components/Lists (ListPanel, ListToolbar, ListSearch, ListChip,
   ListTable, ListEmpty, ListLoading, ListPager, RowMenu). Connections, Projects,
   Backup and Restore jobs, Activity, Audit trail, Webhooks, Users and Blackout
   windows use these and nothing else for their list chrome: one white card with
   the toolbar on top, one table (uppercase column labels, one row height,
   horizontal rules only), one empty state, one loading state, one pager.
   --------------------------------------------------------------------------- */

.qcb-list {
    margin-bottom: 1.5rem;
    /* Not overflow:hidden: a row's menu opens outside the card. The corners are
       kept by the first and last child instead. */
}

/* Toolbar: filters on the left, the list's own tools on the right, chips in a
   row of their own. */
.qcb-list-toolbar {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.qcb-list-toolbar-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem 0.75rem;
}

.qcb-list-filters,
.qcb-list-tools {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
    min-width: 0;
}

.qcb-list-filters {
    flex: 1 1 28rem;
}

.qcb-list-search {
    flex: 1 1 16rem;
    min-width: 12rem;
    max-width: 24rem;
    margin-bottom: 0;
}

.qcb-list-search .qcb-search-input,
.qcb-filter-input {
    padding-top: 0.5rem;
    padding-bottom: 0.5rem;
}

/* A plain text filter beside the selects (Audit trail's Who and What). */
.qcb-filter-input {
    flex: 1 1 11rem;
    min-width: 0;
    max-width: 16rem;
    padding-left: 0.75rem;
    padding-right: 0.75rem;
    font-size: 0.875rem;
    border: 1px solid var(--qcb-gray-200);
    border-radius: var(--qcb-radius-control);
    background: var(--qcb-surface);
}

.qcb-filter-input:focus {
    outline: none;
    border-color: var(--qcb-teal-500);
    box-shadow: 0 0 0 3px var(--qcb-teal-50);
}

.qcb-list-filters .qcb-filter-select {
    min-width: 10rem;
    max-width: 16rem;
}

/* Filter chips: a toggle with a count. */
.qcb-list-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}

.qcb-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.8125rem;
    font-weight: 500;
    border: 1px solid var(--qcb-gray-200);
    cursor: pointer;
    white-space: nowrap;
    transition: background-color 0.15s ease, border-color 0.15s ease;
}

.qcb-chip:hover:not(.active) {
    background: var(--qcb-gray-50);
    border-color: var(--qcb-gray-300);
}

.qcb-chip.active {
    font-weight: 600;
}

.qcb-chip-count {
    font-size: 0.75rem;
    text-align: center;
    border-radius: 9999px;
}

/* The table. */
.qcb-list-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
    /* Keeps a visually hidden header label inside the scroll box on a phone. */
    position: relative;
}

.qcb-list-table > thead > tr > th {
    text-align: left;
    border-bottom: 1px solid var(--qcb-border);
    white-space: nowrap;
    vertical-align: bottom;
}

/* The last column: the row's action or its menu, pushed right. */
.qcb-list-actions-col {
    width: 1%;
    white-space: nowrap;
    text-align: right;
}

.qcb-list-table > tbody > tr > td.qcb-list-actions-col {
    padding-top: 0.5rem;
    padding-bottom: 0.5rem;
}

/* Numbers line up by magnitude. */
.qcb-list-num {
    text-align: right;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

/* A row's own details, opened from the row (Audit trail). */
.qcb-list-table > tbody > tr.qcb-list-detail-row > td {
    height: auto;
    padding-top: 0.25rem;
    background: var(--qcb-surface-muted);
}

/* The row menu. */
.qcb-row-menu {
    display: inline-flex;
}

.qcb-row-menu-btn {
    color: var(--qcb-gray-500);
}

.qcb-row-menu-btn:hover,
.qcb-row-menu-btn[aria-expanded="true"] {
    background-color: var(--qcb-gray-100);
    color: var(--qcb-gray-800);
}

.qcb-row-menu-list .dropdown-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
}

.qcb-row-menu-list .dropdown-item:disabled {
    opacity: 0.5;
}

/* A status in a row: a word and an icon on a tint. The word carries the meaning,
   the colour only repeats it. */
.qcb-status {
    display: inline-flex;
    align-items: center;
    line-height: 1.4;
    white-space: nowrap;
}

/* A deferral is not a failure and not a run (#144): muted, and in italics. */
.qcb-status--defer {    font-style: italic; }

/* Empty and loading inside the card draw no card of their own. */
.qcb-list > .qcb-empty-state {
    border: 0;
    background: transparent;
    padding: 3rem 1.5rem;
}

.qcb-list > .qcb-empty-state .qcb-empty-text:last-child {
    margin-bottom: 0;
}

.qcb-loading-spinner {
    width: 2rem;
    height: 2rem;
    border-width: 0.2rem;
    color: var(--qcb-teal-600);
}

.qcb-list > .qcb-loading {
    padding: 3rem 1.5rem;
}

.qcb-loading--inline {
    padding: 1.5rem 1rem;
    text-align: left;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.qcb-loading--inline .qcb-loading-spinner {
    width: 1.25rem;
    height: 1.25rem;
    border-width: 0.15rem;
}

.qcb-loading--inline p {
    margin: 0;
}

/* The pager, at the foot of the card. */
.qcb-list-pager {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem 0.75rem;
    padding: 0.625rem 1rem;
    font-size: 0.8125rem;
}

.qcb-list-pager b {
    color: var(--qcb-gray-900);
}

.qcb-list-pager-nav {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
}

.qcb-list-pager-size {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    margin: 0;
    font-weight: 600;
}

.qcb-list-pager-select.qcb-filter-select {
    min-width: 4.75rem;
    padding-top: 0.3rem;
    padding-bottom: 0.3rem;
}

.qcb-list-pager-btn.qcb-btn {
    padding: 0.3rem 0.55rem;
}

.qcb-list-pager-page {
    min-width: 6.5rem;
    text-align: center;
}

/* A count line over a card grid, where there is no table foot to hold it. */
.qcb-list-summary {
    margin: 0 0 0.75rem;
    font-size: 0.8125rem;
}

.qcb-chip:focus-visible,
.qcb-row-menu-btn:focus-visible,
.qcb-list-pager-btn:focus-visible {
    outline: 3px solid var(--qcb-teal-600);
    outline-offset: 2px;
}

@media (max-width: 640px) {

    /* Each filter takes the row; the tools stay on one line under them. */
    .qcb-list-filters > :not(.qcb-chip),
    .qcb-list-search,
    .qcb-list-filters .qcb-filter-select,
    .qcb-filter-input {
        flex: 1 1 100%;
        max-width: none;
        min-width: 0;
    }

    .qcb-list-tools {
        width: 100%;
    }

    .qcb-list-pager {
        padding: 0.625rem 0.75rem;
    }
}

/* A Remix icon that turns while something is in hand (Refresh, Running). Still
   for anyone who asked the system for less motion. */
.qcb-spin {
    display: inline-block;
    animation: qcb-spin 1s linear infinite;
}

/* A large tick or cross in a table cell. */
.qcb-icon-xl {
    font-size: 1.5em;
    line-height: 0.04167em;
    vertical-align: -0.125em;
}

@keyframes qcb-spin {
    to { transform: rotate(360deg); }
}

@media (prefers-reduced-motion: reduce) {
    .qcb-spin {
        animation: none;
    }
}

/* A card in a list's grid shrinks to the column: a long address in it is cut
   short rather than widening the page on a phone. */
.qcb-card-grid > * {
    min-width: 0;
}

.qcb-list-table > thead > tr > th.qcb-list-num {
    text-align: right;
}

/* A card in a list's grid reads at 4.5:1: its subtitle and its footer link were
   gray-400 and teal-600 on white (2.5:1 and 3.7:1). */
.qcb-card-grid .qcb-card-subtitle {
    color: var(--qcb-gray-600);
}

.qcb-card-grid .qcb-card-footer-link {
    color: var(--qcb-teal-700);
}

/* ---- End of Lists (#423) ---- */

/* ===========================================================================
   Job list (#233): the Cards, and the cell pieces the job, project and
   connection tables share (jl-name, jl-sub, jl-link, the status dot), prefixed
   jl-. The toolbar, the table and the chips are the shared list's (#423, above).
   =========================================================================== */

.jl-view-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-weight: 500;
    cursor: pointer;
}

.jl-view-btn:hover:not(.active) {
    color: var(--qcb-gray-900);
}

.jl-view-btn:focus-visible,
.jl-sort:focus-visible,
.jl-link:focus-visible {
    outline: 3px solid var(--qcb-teal-600);
    outline-offset: 2px;
}

/* ── Shared cell pieces ─────────────────────────────────────────────────── */

.jl-name {
    overflow-wrap: anywhere;
}

.jl-sub {
    margin-top: 0.15rem;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.3rem;
}

.jl-link {
    text-decoration: none;
}

/* A link that runs an action rather than going somewhere: View live log (#236). */
.jl-linkbtn {
    background: none;
    border: 0;
    padding: 0;
    font: inherit;
    font-weight: 600;
    cursor: pointer;
}

.jl-linkbtn:hover {
    text-decoration: underline;
}

.jl-link:hover {
    text-decoration: underline;
}

.jl-link--asset:hover {
    color: var(--qcb-gray-900);
    text-underline-offset: 3px;
}

.jl-sep {
    color: var(--qcb-gray-300);
}

.jl-deploy {
    align-items: center;
    gap: 0.2rem;
}

.jl-status {
    color: var(--qcb-gray-800);
    white-space: nowrap;
}

/* Status dot. The text next to it always says the status too, so colour is
   never the only carrier of the meaning. */

.jl-attn {
    margin-top: 0.3rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem;
}

/* The last-run status and, beside it, the verification icon (#350). The status
   keeps its own nowrap; the icon wraps under it only on a card too narrow for
   both. */
.jl-status-line {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    column-gap: 0.1rem;
}

/* The latest backup verification as an icon (<BackupVerificationIcon>). Each
   result has its own glyph as well as its own colour, so colour is never the
   only difference. All four colours are 4.5:1 or better on white. */
.qcb-hint.bv-icon {
    width: 1.35rem;
    height: 1.35rem;
    font-size: 1.05rem;
}

.qcb-hint.bv-icon--ok,
.qcb-hint.bv-icon--ok:hover,
.qcb-hint.bv-icon--ok:focus-visible { color: var(--qcb-green-700); }

.qcb-hint.bv-icon--fail,
.qcb-hint.bv-icon--fail:hover,
.qcb-hint.bv-icon--fail:focus-visible { color: var(--qcb-red-700); }

.qcb-hint.bv-icon--warn,
.qcb-hint.bv-icon--warn:hover,
.qcb-hint.bv-icon--warn:focus-visible { color: var(--qcb-amber-700); }

.qcb-hint.bv-icon--none,
.qcb-hint.bv-icon--none:hover,
.qcb-hint.bv-icon--none:focus-visible { color: var(--qcb-gray-500); }

.qcb-hint.bv-icon:hover {
    background: var(--qcb-gray-100);
}

.jl-actions {
    flex-wrap: nowrap;
    cursor: default;
}

/* ── Table ──────────────────────────────────────────────────────────────── */

.jl-sort {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0;
    border: 0;
    background: none;
    font: inherit;
    color: inherit;
    text-transform: inherit;
    letter-spacing: inherit;
    cursor: pointer;
}

.jl-sort i {
    font-size: 0.85rem;
    color: var(--qcb-gray-400);
}

.jl-sort:hover i {
    color: var(--qcb-gray-600);
}

/* ── Cards ──────────────────────────────────────────────────────────────── */

.jl-cards {
    display: grid;
}

/* The last outcome is a stripe on the left edge rather than a tinted header,
   so a red card is noticed without the whole card shouting. */
/* A border rather than a clipped pseudo-element: the card must not clip, or
   its row menu would open cut off at the card's edge. */
.jl-card {
    display: flex;
    flex-direction: column;
}

.jl-card-title {
    margin: 0;
}

.jl-facts {
    margin: 0;
    display: grid;
}

.jl-fact {
    display: grid;
    grid-template-columns: 6rem 1fr;
    gap: 0.5rem;
}

.jl-fact dd {
    margin: 0;
    min-width: 0;
}

/* ── Sort by, Created, New (#344) ───────────────────────────────────────── */

/* A job created in the last 24 hours (#598): "Created 2 min ago" on the line under
   its name, with a dot. It replaced a New tag and a stripe down the row. */
.jl-created-new {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    color: var(--qcb-teal-700);
    font-weight: 500;
}

.jl-created-new::before {
    content: "";
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
}

/* The job just created: tinted, then faded out. JobListBase takes the class
   off after JobListHighlight.Duration (6 s), which is also what ends it where
   motion is reduced and nothing fades. */
@keyframes jl-row-created {
    0%, 40% { background-color: var(--qcb-teal-50); }
    100% { background-color: transparent; }
}

@keyframes jl-card-created {
    0%, 40% { background-color: var(--qcb-teal-50); }
    100% { background-color: var(--qcb-surface); }
}

.qcb-list-table > tbody > tr.jl-just-created > td {
    animation: jl-row-created 6s ease-out forwards;
}

.jl-card.jl-just-created,
.qcb-card.jl-just-created {
    animation: jl-card-created 6s ease-out forwards;
}

@media (prefers-reduced-motion: reduce) {
    .qcb-list-table > tbody > tr.jl-just-created > td {
        animation: none;
        background-color: var(--qcb-teal-50);
    }

    .jl-card.jl-just-created,
    .qcb-card.jl-just-created {
        animation: none;
        background-color: var(--qcb-teal-50);
    }
}

/* ── Projects and Connections tables (#384) ──────────────────────────────
   They are the shared list (#423). Only the storage logo beside a connection's
   name is their own. */
.cl-name {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* ── End of job list (#233) ─────────────────────────────────────────────── */

/* ── Restore drill results (#302) ───────────────────────────────────────── */

.qcb-drill-head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
}

.qcb-drill-runpicker {
    width: auto;
    max-width: 22rem;
}

.qcb-drill-checks summary {
    cursor: pointer;
    font-size: 0.875rem;
}

.qcb-drill-checks ul {
    margin-top: 0.25rem;
    font-size: 0.875rem;
}

.qcb-drill-checks li + li {
    margin-top: 0.25rem;
}

/* ── End of restore drill results (#302) ────────────────────────────────── */

/* ==========================================================================
   Radio buttons and checkboxes you can see (#332)

   Bootstrap draws an unchecked radio or checkbox with --bs-border-color
   (#dee2e6), which is barely visible on white, and the checked colour came out
   teal for some controls and Bootstrap blue for others. One rule for the app: a
   border dark enough to find, the brand teal when checked, and a focus ring that
   shows from the keyboard. Switches keep their own look.
   ========================================================================== */
.form-check-input:where([type="radio"], [type="checkbox"]):not([role="switch"]) {
    border: 1.5px solid var(--qcb-gray-500);
}

.form-check-input:where([type="radio"], [type="checkbox"]):not([role="switch"]):checked,
.form-check-input[type="checkbox"]:not([role="switch"]):indeterminate {
    background-color: var(--qcb-teal-600);
    border-color: var(--qcb-teal-600);
}

.form-check-input:where([type="radio"], [type="checkbox"]):focus-visible {
    outline: 2px solid var(--qcb-teal-700);
    outline-offset: 2px;
}
