body.qa-db-locked {
    overflow: hidden;
}

body.qa-db-locked .app-footer {
    display: none;
}

.qa-db-screen {
    position: fixed;
    top: var(--qa-db-offset, 112px);
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    flex-direction: column;
    background: var(--color-surface-muted);
}

.qa-db-screen-head {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-3);
    padding: var(--space-3) var(--space-5);
    background: var(--color-surface-base);
    border-bottom: var(--border-width-1) solid var(--color-border-subtle);
}

.qa-db-screen-head-left {
    display: flex;
    align-items: center;
    gap: var(--space-4);
    min-width: 0;
}

.qa-db-screen-count {
    font-size: var(--font-size-sm);
    color: var(--color-text-muted);
    white-space: nowrap;
}

.qa-db-screen-grid {
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
    padding: var(--space-4) var(--space-5);
}

.qa-db-screen-panels {
    flex: 0 0 auto;
    display: flex;
    flex-direction: column;
    max-height: 42vh;
    background: var(--color-surface-base);
    border-top: var(--border-width-1) solid var(--color-border-subtle);
}

.qa-db-screen-panels--collapsed {
    max-height: none;
}

.qa-db-resource {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-2);
    width: 100%;
}

.qa-db-resource-name {
    font-size: var(--font-size-base);
    font-weight: var(--font-weight-semibold);
    color: var(--color-text-accent);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.qa-db-resource-actions {
    display: inline-flex;
    gap: var(--space-1);
    flex: 0 0 auto;
}

.qa-db-resource-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: var(--size-8);
    height: var(--size-8);
    border: var(--border-width-1) solid var(--color-border-default);
    background: var(--color-surface-base);
    color: var(--color-text-secondary);
    border-radius: var(--radius-md);
    cursor: pointer;
    text-decoration: none;
}

.qa-db-resource-btn:hover {
    background: var(--color-surface-hover);
    color: var(--color-text-primary);
}

.qa-db-card {
    width: 100%;
    height: 100%;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: var(--space-1-5) var(--space-2);
    border-radius: var(--radius-md);
    border: var(--border-width-1) solid rgba(15, 23, 42, 0.18);
    cursor: pointer;
    overflow: hidden;
}

.qa-db-card--selected {
    box-shadow: var(--shadow-focus-ring);
}

.qa-db-card-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-1);
}

.qa-db-card-time {
    font-size: var(--font-size-xs);
    font-weight: var(--font-weight-medium);
    opacity: 0.9;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.qa-db-card-top-right {
    display: inline-flex;
    align-items: center;
    gap: var(--space-1);
    flex: 0 0 auto;
}

.qa-db-card-kind {
    font-size: 9px;
    font-weight: var(--font-weight-bold);
    letter-spacing: var(--letter-spacing-wide);
    text-transform: uppercase;
    padding: 1px 4px;
    border-radius: var(--radius-xs);
    background: rgba(255, 255, 255, 0.25);
}

.qa-db-card-zone {
    width: 12px;
    height: 12px;
    border-radius: var(--radius-full);
    border: 2px solid rgba(255, 255, 255, 0.85);
    flex: 0 0 auto;
}

.qa-db-card-arrived {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: #16a34a;
    border: 2px solid rgba(255, 255, 255, 0.85);
    flex: 0 0 auto;
}

.qa-db-card-d-arrived {
    position: absolute;
    top: 4px;
    right: 22px;
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: #16a34a;
    box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.85);
}

.qa-db-card-name {
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-semibold);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.qa-db-card-d {
    position: relative;
    width: 100%;
    height: 100%;
    box-sizing: border-box;
    display: flex;
    align-items: center;
    padding: var(--space-1) var(--space-6) var(--space-1) var(--space-2);
    border: var(--border-width-2) solid var(--qa-cd-status, var(--color-border-default));
    border-radius: var(--radius-md);
    background: linear-gradient(to right,
        var(--color-surface-base) 50%,
        color-mix(in srgb, var(--qa-cd-status, var(--color-surface-base)) 16%, var(--color-surface-base)) 50%);
    cursor: pointer;
}

.qa-db-card-d--selected {
    box-shadow: var(--shadow-focus-ring);
}

.qa-db-card-d-name {
    flex: 1 1 auto;
    min-width: 0;
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-semibold);
    color: var(--color-text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.qa-db-card-d-zone {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 13px;
    height: 13px;
    border-radius: var(--radius-full);
    box-shadow: 0 0 0 1px rgba(15, 23, 42, 0.28);
}

.qa-db-card-d-zone--empty {
    background: var(--color-surface-muted);
    box-shadow: 0 0 0 1px var(--color-border-default);
}

.qa-db-zone-tip {
    display: none;
    position: absolute;
    top: calc(100% + 8px);
    right: -5px;
    z-index: 6;
    align-items: center;
    gap: var(--space-1-5);
    padding: var(--space-1) var(--space-2);
    background: var(--color-text-primary);
    color: var(--color-surface-base);
    border-radius: var(--radius-sm);
    font-size: var(--font-size-xs);
    font-weight: var(--font-weight-medium);
    white-space: nowrap;
    box-shadow: var(--shadow-md);
    pointer-events: none;
}

.qa-db-card-d-zone:hover .qa-db-zone-tip {
    display: flex;
}

.qa-db-zone-tip::before {
    content: "";
    position: absolute;
    bottom: 100%;
    right: 11px;
    border: 5px solid transparent;
    border-bottom-color: var(--color-text-primary);
}

.qa-db-zone-tip-dot {
    width: 9px;
    height: 9px;
    border-radius: var(--radius-full);
    flex: 0 0 auto;
}

.qa-db-zone-tip-dot--empty {
    background: var(--color-border-default);
}

.qa-db-backdrop {
    position: fixed;
    inset: 0;
    z-index: var(--z-popover);
    background: transparent;
}

.qa-db-pop {
    position: fixed;
    z-index: calc(var(--z-popover) + 1);
    width: 290px;
    background: var(--color-surface-base);
    color: var(--color-text-primary);
    border: var(--border-width-1) solid var(--color-border-subtle);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
    cursor: default;
    overflow: hidden;
}

.qa-db-pop-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-2) var(--space-3);
    border-bottom: var(--border-width-1) solid var(--color-border-chrome);
    background: var(--color-surface-subtle);
}

.qa-db-pop-title {
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-semibold);
    color: var(--color-text-primary);
}

.qa-db-pop-close {
    border: 0;
    background: none;
    cursor: pointer;
    font-size: var(--font-size-xl);
    line-height: 1;
    color: var(--color-text-muted);
    padding: 0 var(--space-1);
}

.qa-db-pop-close:hover {
    color: var(--color-text-primary);
}

.qa-db-pop-body {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
    padding: var(--space-3);
}

.qa-db-pop-row {
    display: flex;
    align-items: flex-start;
    gap: var(--space-2);
    font-size: var(--font-size-sm);
    color: var(--color-text-secondary);
}

.qa-db-pop-row-icon {
    color: var(--color-text-muted);
    flex: 0 0 auto;
    margin-top: 1px;
}

.qa-db-pop-notes {
    font-size: var(--font-size-sm);
    color: var(--color-text-muted);
    background: var(--color-surface-muted);
    border-radius: var(--radius-sm);
    padding: var(--space-2);
}

.qa-db-pop-link {
    align-self: flex-start;
    border: 0;
    background: none;
    padding: 0;
    font-family: inherit;
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-medium);
    color: var(--color-text-accent);
    text-decoration: underline;
    cursor: pointer;
}

.qa-db-pop-foot {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-2) var(--space-3);
    border-top: var(--border-width-1) solid var(--color-border-chrome);
    background: var(--color-surface-subtle);
}

.qa-db-pop-foot-select {
    flex: 1 1 auto;
    min-width: 0;
}

.qa-db-panel-tabs {
    flex: 0 0 auto;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 2px;
    padding: var(--space-2) var(--space-3) 0;
    border-bottom: var(--border-width-1) solid var(--color-border-chrome);
    background: var(--color-surface-subtle);
}

.qa-db-panel-tab {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    background: transparent;
    border: 0;
    border-bottom: var(--border-width-2) solid transparent;
    color: var(--color-text-secondary);
    cursor: pointer;
    font-family: inherit;
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-medium);
    padding: var(--space-2) var(--space-3);
}

.qa-db-panel-tab:hover {
    color: var(--color-text-primary);
}

.qa-db-panel-tab--active {
    color: var(--color-text-accent);
    border-bottom-color: var(--color-accent-default);
}

.qa-db-panel-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.25rem;
    height: 1.25rem;
    padding: 0 var(--space-1-5);
    border-radius: var(--radius-full);
    background: var(--color-surface-active);
    color: var(--color-text-secondary);
    font-size: var(--font-size-xs);
    font-weight: var(--font-weight-semibold);
}

.qa-db-panel-tab--active .qa-db-panel-count {
    background: var(--color-accent-default);
    color: var(--color-accent-contrast);
}

.qa-db-panel-collapse {
    margin-left: auto;
    align-self: center;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: var(--size-8);
    height: var(--size-8);
    border: 0;
    background: transparent;
    color: var(--color-text-muted);
    cursor: pointer;
}

.qa-db-panel-collapse:hover {
    color: var(--color-text-primary);
}

.qa-db-panel-body {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
}

.qa-db-panel-empty {
    padding: var(--space-8) var(--space-4);
    text-align: center;
    color: var(--color-text-muted);
    font-size: var(--font-size-sm);
}

.qa-db-panel-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(232px, 1fr));
    gap: var(--space-3);
    padding: var(--space-3) var(--space-4);
}

.qa-db-jobcard {
    display: flex;
    flex-direction: column;
    padding: 0;
    border: var(--border-width-1) solid var(--color-accent-default);
    border-radius: var(--radius-md);
    background: var(--color-surface-base);
    box-shadow: var(--shadow-xs);
    cursor: pointer;
    overflow: hidden;
    font-family: inherit;
    text-align: left;
    user-select: none;
}

.qa-db-jobcard:hover {
    box-shadow: var(--shadow-sm);
}

.qa-db-jobcard-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-2);
    padding: var(--space-1) var(--space-2);
    background: var(--color-accent-default);
    color: var(--color-accent-contrast);
}

.qa-db-jobcard-time {
    font-size: var(--font-size-xs);
    font-weight: var(--font-weight-medium);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.qa-db-jobcard-kind {
    font-size: var(--font-size-xs);
    font-weight: var(--font-weight-semibold);
    flex: 0 0 auto;
}

.qa-db-jobcard-body {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-2);
    padding: var(--space-2);
}

.qa-db-jobcard-name {
    flex: 1 1 auto;
    min-width: 0;
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-semibold);
    color: var(--color-text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.qa-db-jobcard-zone {
    width: 13px;
    height: 13px;
    border-radius: var(--radius-full);
    flex: 0 0 auto;
    box-shadow: 0 0 0 1px rgba(15, 23, 42, 0.28);
}

.qa-db-jobcard-zone--empty {
    background: var(--color-surface-muted);
    box-shadow: 0 0 0 1px var(--color-border-default);
}
