/* The object picker's settings panel (#596, canvas "Job editor, 7 Nov", E_Picker and
   E_Picker_Hidden). The type's table to browse and pick has the picker's whole width;
   its picks with their settings are in a drawer over the page (#678, below),
   which takes no room in the layout. Only theme tokens, so light and dark both follow. */

.qots-layout {
    min-width: 0;
}

.qots-browse {
    min-width: 0;
}

/* Open or closed, the panel toggle beside Actions says what is in the job (#671,
   picker-layout.css). */

/* The How it restores column: the choice, and under it the second one. */
.qots-how-cell {
    display: flex;
    flex-direction: column;
}

.qots-how-detail,
.qots-how-none {
    font-size: 0.75rem;
    color: var(--qcb-text-muted);
}

/* ── The drawer (#678) ───────────────────────────────────────────────

   "In this backup", "In this restore" and "In this promotion" (ObjectPicker/
   PicksPanelShell) lie over the page on the right edge of the window, from top to
   bottom, with a light backdrop, so the picker's table keeps its whole width. The
   model is qlik-migration-service's AppDetailsPanel. The panel's head stays and its
   body scrolls (.qps below). The screen's width at phone width.

   Layers: over the side rail (1020), the sticky save bar and the full-screen picker
   (990 and 995); under dialogs and the picker's popovers (1060), hints (1080) and
   toasts. A bulk change opened from the drawer is a dialog over it. */

.qpd {
    position: fixed;
    inset: 0;
    z-index: 1040;
}

/* A click beside the drawer closes it. */
.qpd-backdrop {
    position: absolute;
    inset: 0;
    background: var(--qcb-scrim);
    opacity: 0.45;
}

.qpd-box {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    display: flex;
    flex-direction: column;
    width: min(31.25rem, 100vw);
    background: var(--qcb-surface);
    color: var(--qcb-text);
    border-left: 1px solid var(--qcb-border);
    box-shadow: var(--qcb-shadow-pop);
    outline: none;
    animation: qpd-in 0.18s ease-out;
}

.qpd-box > .qps {
    flex: 1 1 auto;
}

/* The close button, as a popover's: an icon, "Close" in its tooltip. */
.qps-close {
    flex: none;
    border-color: transparent;
}

@keyframes qpd-in {
    from {
        transform: translateX(1.5rem);
        opacity: 0;
    }

    to {
        transform: none;
        opacity: 1;
    }
}

@media (prefers-reduced-motion: reduce) {
    .qpd-box {
        animation: none;
    }
}

@media (max-width: 575.98px) {
    .qpd-box {
        width: 100vw;
        border-left: 0;
    }
}

/* Full screen: the picker's area covers the window (990) and the save bar is over it
   (995). The drawer is inside the area, so while it is open the save bar waits under
   it, as the rest of the page does. */
body:has(.qcb-objects.is-fullscreen .qpd) .qcb-page .qcb-savebar.is-shown {
    z-index: 985;
}

/* ── The panel ───────────────────────────────────────────────────────── */

/* It fills the drawer's height: the head stays, the body scrolls. */
.qps {
    display: flex;
    flex-direction: column;
    min-width: 0;
    min-height: 0;
    height: 100%;
    background: var(--qcb-surface);
    color: var(--qcb-text);
}

.qps-head {
    flex: none;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    padding: 0.625rem 1rem;
    border-bottom: 1px solid var(--qcb-border);
}

.qps-title {
    margin: 0;
    font-size: 0.9375rem;
    font-weight: 600;
}

.qps-total {
    margin-left: 0.25rem;
    font-weight: 400;
    color: var(--qcb-text-muted);
    font-variant-numeric: tabular-nums;
}

.qps-body {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
}

/* Ticked picks: "2 selected", Set app ID, Set what it restores, More, Remove. */
.qps-bulk {
    position: sticky;
    top: 0;
    z-index: 1;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
    padding: 0.625rem 1rem;
    border-bottom: 1px solid var(--qcb-border);
    background: var(--qcb-surface-muted);
    font-size: 0.8125rem;
}

.qps-bulk-count {
    font-weight: 600;
}

.qps-bulk-spacer {
    flex: 1 1 auto;
}

.qps-setter {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
    padding: 0.625rem 1rem;
    border-bottom: 1px solid var(--qcb-border);
    background: var(--qcb-surface-muted);
}

.qps-setter .form-select {
    flex: 1 1 12rem;
    width: auto;
}

.qps-status {
    margin: 0;
    padding: 0.5rem 1rem;
    border-bottom: 1px solid var(--qcb-border);
    font-size: 0.8125rem;
    color: var(--qcb-text-muted);
}

.qps-group-head {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.625rem 1rem 0.25rem;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--qcb-text-muted);
}

.qps-filter {
    padding: 0.25rem 1rem 0.5rem;
}

/* The pager above the cards (#678), the one the tables have: a page of picks at a time. */
.qps-pager {
    display: flex;
    padding: 0 1rem 0.5rem;
}

.qps-pager .qots-pager {
    margin-left: 0;
}

/* "Select all N" at the end of the head line, beside the box that ticks the page. */
.qps-select-all {
    margin-left: auto;
    font-size: 0.75rem;
}

/* The search icon sits inside the box, as in the picker's own search (#607). */
.qps-filter.qots-search > i {
    left: 1.625rem;
}

/* One pick */
.qps-card {
    display: grid;
    grid-template-columns: 1.375rem minmax(0, 1fr);
    column-gap: 0.375rem;
    row-gap: 0.5rem;
    padding: 0.75rem 1rem 0.875rem;
    border-bottom: 1px solid var(--qcb-border);
}

.qps-card.is-ticked {
    background: var(--qcb-teal-50);
}

/* ── Compact rows (#678) ─────────────────────────────────────────────

   A pick in two short lines: its box, its name and how it is backed up or restored (the
   table's words), then where it is and whose; and Remove. A click opens its card in its place. The
   choice sits beside the pager's Rows, as two icon buttons. */

.qps-viewbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
    padding: 0 1rem 0.5rem;
}

.qps-viewbar .qps-pager {
    padding: 0;
}

.qps-density {
    display: inline-flex;
    gap: 0.25rem;
    margin-left: auto;
}

.qps-density-btn {
    width: 1.875rem;
    height: 1.875rem;
}

.qps-density-btn[aria-pressed="true"] {
    border-color: var(--qcb-teal-600);
    background: var(--qcb-teal-50);
    color: var(--qcb-teal-700);
}

.qps-row {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    min-width: 0;
    padding: 0.375rem 0.75rem 0.375rem 1rem;
    border-bottom: 1px solid var(--qcb-border);
}

.qps-row.is-ticked {
    background: var(--qcb-teal-50);
}

.qps-row-main {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    gap: 0.0625rem;
    min-width: 0;
    padding: 0;
    border: 0;
    background: none;
    font: inherit;
    color: inherit;
    text-align: left;
    cursor: pointer;
}

.qps-row-main:hover .qps-row-name {
    color: var(--qcb-teal-700);
}

.qps-row-main:focus-visible {
    outline: 2px solid var(--qcb-teal-600);
    outline-offset: 2px;
}

/* The name and how it is backed up or restored; the name has the room. */
.qps-row-line,
.qps-row-facts {
    display: flex;
    align-items: center;
    min-width: 0;
    white-space: nowrap;
}

.qps-row-line {
    gap: 0.375rem;
    line-height: 1.25rem;
}

.qps-row-chevron {
    flex: none;
    color: var(--qcb-text-muted);
}

.qps-row-name,
.qps-row-owner,
.qps-row-how {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.qps-row-name {
    flex: 0 1 auto;
    font-size: 0.875rem;
    font-weight: 500;
}

.qps-row-how {
    flex: 0 1 auto;
    max-width: 45%;
    margin-left: auto;
    padding-left: 0.5rem;
    font-size: 0.75rem;
    color: var(--qcb-text-muted);
}

.qps-row .qps-missing {
    flex: none;
    margin-left: 0;
}

/* Where it is and whose, under the name, as on a card: the owner is cut first. */
.qps-row-facts {
    padding-left: 1.375rem;
    font-size: 0.75rem;
    line-height: 1.125rem;
    color: var(--qcb-text-muted);
}

.qps-row-place {
    display: flex;
    flex: 0 0 auto;
    min-width: 0;
    max-width: 66%;
}

.qps-row-sep {
    flex: none;
    white-space: pre;
}

.qps-row-owner {
    flex: 1 1 0;
    min-width: 2rem;
}

/* The card a compact row opened, among the rows. */
.qps-cards.is-compact .qps-card.is-open {
    background: var(--qcb-hover);
}

.qps-cards.is-compact .qps-card.is-open.is-ticked {
    background: var(--qcb-teal-50);
}

.qps-tick {
    margin: 0.1875rem 0 0;
}

.qps-card-head {
    display: flex;
    justify-content: space-between;
    gap: 0.5rem;
    min-width: 0;
}

.qps-card-title {
    min-width: 0;
}

.qps-card-name {
    font-size: 0.875rem;
    font-weight: 500;
    overflow-wrap: anywhere;
}

/* Where it is and whose (#682): the image, the place, " · " and the owner on one line,
   centred on the text. A long name is cut short; its tooltip has it whole. */
.qps-card-meta {
    display: flex;
    align-items: center;
    min-width: 0;
    font-size: 0.75rem;
    line-height: 1.25rem;
    color: var(--qcb-text-muted);
    white-space: nowrap;
}

/* The place keeps its whole name up to two thirds of the line; the owner is cut first. */
.qps-card-meta > .qcb-place {
    flex: 0 0 auto;
    min-width: 0;
    max-width: 66%;
}

.qps-card-meta-sep {
    flex: none;
    white-space: pre;
}

.qps-card-owner {
    flex: 1 1 0;
    min-width: 2rem;
    overflow: hidden;
    text-overflow: ellipsis;
}

.qps-remove {
    flex: none;
    width: 1.75rem;
    height: 1.75rem;
    padding: 0;
    border: 0;
    border-radius: 6px;
    background: none;
    color: var(--qcb-text-muted);
    font-size: 1rem;
    line-height: 1;
}

.qps-remove:hover {
    background: var(--qcb-hover);
    color: var(--qcb-text);
}

/* Label and field side by side, a description under its field. */
.qps-fields {
    grid-column: 2;
    display: grid;
    grid-template-columns: 5.5rem minmax(0, 1fr);
    align-items: center;
    gap: 0.375rem 0.5rem;
    font-size: 0.8125rem;
}

.qps-fields:empty {
    display: none;
}

.qps-label {
    margin: 0;
    font-weight: 400;
    color: var(--qcb-text-muted);
}

.qps-control {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    min-width: 0;
}

.qps-control .form-select {
    flex: 1 1 auto;
    min-width: 0;
}

.qps-desc {
    font-size: 0.75rem;
    line-height: 1.125rem;
    color: var(--qcb-text-muted);
}

.qps-check {
    margin: 0;
    min-height: 0;
}

/* A checkbox on its own row spans both columns, under the pick's name (#613). */
.qps-fields > .qps-check {
    grid-column: 1 / -1;
}

.qps-checks {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem 0.875rem;
}

.qps-owned {
    display: flex;
    align-items: center;
    min-width: 0;
}

.qps-card-more {
    grid-column: 2;
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem 0.875rem;
    font-size: 0.8125rem;
}

.qps-link {
    padding: 0;
    border: 0;
    background: none;
    font: inherit;
    font-weight: 500;
    color: var(--qcb-teal-700);
    text-decoration: underline;
    text-decoration-color: var(--qcb-border-strong);
    text-underline-offset: 3px;
}

.qps-link:hover {
    text-decoration-color: currentColor;
}

.qps-empty,
.qps-others,
.qps-foot {
    margin: 0;
    padding: 0.75rem 1rem;
    font-size: 0.75rem;
    line-height: 1.125rem;
    color: var(--qcb-text-muted);
}

.qps-others + .qps-foot {
    padding-top: 0;
}

.qps-link:focus-visible,
.qps-remove:focus-visible,
.qps-tick:focus-visible {
    outline: 2px solid var(--qcb-teal-600);
    outline-offset: 2px;
}

/* A pick the backup (or the last fetch) no longer has: words in the attention
   colour, no coloured label (the refactor's rule, ui-pages.css). */
.qps-missing {
    margin-left: 0.375rem;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--qcb-attention);
}
